WorksheetsSQL QUIZ
Total questions: 10
Worksheet time: 5mins
1. Consider the Employee Table with the following Attributes
employee(id, name, project_id, salary, city)
How to select all the records of the employees who does not belong to "Chennai" city from the "employee table" ?
select * from employee where city != ‘chennai’
select * from employee where city<>’chennai’
select * from employee where city like ‘chennai’
select [all] from employee where city<>’chennai’
2. Consider the Employee Table with the following Attributes
Employee (id, name, project_id, salary, city)
Which one of the following is the correct SQL query to fetch the different projects available from the employee table?
select distinct (project_id) from employee;
select unique (project_id) from employee;
select unique project_id from employee;
select distinct project_id from employee;
3. Which of the following is not a valid aggregate function?
count
add
sum
max
4. Which operator is used to compare a value to a specified list of values?
Any
Between
in
All
5. If we have not specified ASC or DESC after a SQL ORDER BY clause, the following is used by default
Desc
Asc
There is no default value
None of the above
6. What is returned by INSTR ('Hi! Welcome ’, 'c')?
(a)
7. How can you change "Thomas" into "Michel" in the "LastName" column in the “Users” table?
UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'
MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'
UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
8. Which of the following can replace the below query?
select name, id from student, courses where student_id = courses_id;
select name, id from student,courses where student_id= id;
select name, id from student natural join courses;
select name, id from student inner join courses;
select name, id from student;
9. Which of the following statement is correct to display the climatic details of all the cities whose humidity is in the range of 60 to 75 from the "weather" table?
SELECT * FROM weather WHERE humidity IN (60 to 75)
SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75
SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)
SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75
10. Which statement is used to get all data from the student table whose name starts with 'p'?
SELECT * FROM student WHERE name LIKE '%p%';
SELECT * FROM student WHERE name LIKE 'p%';
SELECT * FROM student WHERE name LIKE '_p%';
SELECT * FROM student WHERE name LIKE '%p';
