Breaking

Thursday, 13 July 2017

SQL - Select all 4th Year Students from IT department


    SQL - Select all 4th Year Students from IT department




The students table has the following four columns
 id
 name
 department
 year
The table DDL is as below.
CREATE TABLE students(id int,name VARCHAR(100), department VARCHAR(3),year int);
Write the SQL statement to fetch the records (all the columns) of the students belonging to year as 4 and department as IT. The names must be sorted in alphabetically ascending order.


SQL:

       
        select * from students where department='IT' and year=4 order by name;

No comments:

Post a Comment

Like