A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a mysql statement to select data of only CS OR IT departments
Q:

Write a mysql statement to select data of only CS OR IT departments

0

MySQL Where Clause Exercise

Write a mysql statement to select data of only CS OR IT departments

Suppose the table is -

+----+--------------+------------+-----+
| id | name         | department | age |
+----+--------------+------------+-----+
|  1 | Maria Gloria | CS         |  22 |
|  2 | John Smith   | IT         |  23 |
|  3 | Gal Rao      | CS         |  22 |
|  4 | Jakey Smith  | EC         |  24 |
|  5 | Rama Saho    | IT         |  22 |
|  6 | Maria Gaga   | EC         |  23 |
+----+--------------+------------+-----+

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

The following statement is used to get students data of CS OR IT departments only.

mysql> SELECT name, department, age FROM students
    -> WHERE department = 'CS' OR department = 'IT';

Output of the above statement -

+--------------+------------+-----+
| name         | department | age |
+--------------+------------+-----+
| Maria Gloria | CS         |  22 |
| John Smith   | IT         |  23 |
| Gal Rao      | CS         |  22 |
| Rama Saho    | IT         |  22 |
+--------------+------------+-----+

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now