Write a query to display list of students name and their department name who are all from 'Coimbatore'. Sort the result based on students name
Answers
Answered by
5
Answer:
select name, department_name from tablename where columname='Coimbatore' order by name asc;
Explanation:
Answered by
0
The required query is : SELECT name, dept FROM student WHERE city='Coimbatore';
Explanation:
- Let the name of the required details' table be 'student'.
- let the the column in the table 'student' be 'name', 'dept' , 'enroll', 'city' etc. so on.
- Now we need to display the name and department of the students who are from 'Coimbatore' from the table.
- hence we use their corresponding column name from the table , name-> 'name' , department name-> 'dept' and Coimbatore-> 'city' .
- now we use commands such as SELECT( to select the required columns) , FROM (to state the which table we are referring to ) and WHERE (to specify our required condition to select the data item).
- The query is: SELECT name, dept FROM student WHERE city='Coimbatore';
Similar questions