- Selection: Fetching data from the table by eliminating certain rows from it.
- Projection: Fetching data from the table without eliminating any rows from the table.
| NAME | AGE | GENDER | MARKS |
|---|---|---|---|
| Cat | 23 | Male | 93 |
| Rat | 24 | Female | 88 |
| Tiger | 26 | Female | 98 |
| Lion | 18 | male | 34 |
Write a query to display name from the student table.
SELECT name FROM student;
| NAME |
|---|
| Cat |
| Rat |
| Tiger |
| Lion |
Write a query to display name, age, gender from the student table.
SELECT name, age, gender FROM student;
| NAME | AGE | GENDER |
|---|---|---|
| Cat | 23 | Male |
| Rat | 24 | Female |
| Tiger | 26 | Female |
| Lion | 18 | male |
Write a query to display all the data from student table.
SELECT * FROM student;
| NAME | AGE | GENDER | MARKS |
|---|---|---|---|
| Cat | 23 | Male | 93 |
| Rat | 24 | Female | 88 |
| Tiger | 26 | Female | 98 |
| Lion | 18 | male | 34 |
Write a query to display name of student whose age is 22.
SELECT name FROM student WHERE age = 22;
no data found
Write a query to display details of the students whose gender is male.
SELECT * FROM student WHERE gender = 'Male';
| NAME | AGE | GENDER | MARKS |
|---|---|---|---|
| Cat | 23 | Male | 93 |
Write a query to display details of students who scored greater than 60 marks.
SELECT * FROM student WHERE marks > 60;
| NAME | AGE | GENDER | MARKS |
|---|---|---|---|
| Cat | 23 | Male | 93 |
| Rat | 24 | Female | 88 |
| Tiger | 26 | Female | 98 |