NEW
Font size
WorksheetsChallenge Yourself
Total questions: 20
Worksheet time: 10mins
Return the name and genre of each movie with an imdb rating greater than 5 and year greater than 2012.
SELECT name,genre FROM movies WHERE imdb_rating < 5
AND year < 2012
SELECT FROM movies
WHERE Imdb_rating > 5 AND year > 2012;
SELECT name,genre FROM movies
WHERE Imdb_rating > 5 AND year > 2012;
SELECT name, year FROM movies
WHERE Imdb_rating > 5 year > 2012;
Consider the following schema −
STUDENTS(student_code, first_name, last_name, email,
phone_no, date_of_birth, honours_subject, percentage_of_marks);
Which of the following query would display all the students whose first name starts with the character ‘A’?
select first_name from students where first_name like ‘A%’;
select first_name from students where first_name like ‘%A’;
select first_name from students where first_name like ‘%A%’;
select first_name from students where first_name like ‘%A%’;
write the query to get the output as shown in the image.
SELECT * FROM movies FROM imdb_rating>=7 LIMIT 8;
SELECT * FROM movies WHERE genre='horror' AND imdb_rating >=7 LIMIT 8;
SELECT * FROM movies WHERE genre='horror' AND imdb_rating >=7;
SELECT * FROM movies WHERE genre='horror' AND imdb_rating >= 7 LIMIT 8; ORDER BY ASC LIMIT 8;
Write a query to get the output as shown
SELECT genre. year
FROM movies
WHERE genre= action ORDER BY
year DESC LIMIT 11;
none of these
SELECT genre, year
FROM movies
WHERE genre ='action'
ORDER BY year DESC LIMIT 11;
SELECT genre, year
FROM movies
WHERE genre="action'
ORDER BY year ASC LIMIT 11:
If you are only retrieving one column's values, what keyword can you add before the column name to only return unique values?
UNIQUE
DISTINCT
TOP
NOT NULL
According to ORACLE DBMS 'AND OPERATION' and 'OR OPERATION' precedence issue SELECT 'IS TRUE' AS CONDITION FROM DUAL WHERE (1=1 OR 1=0) AND 0=1 GIVES
IS TRUE
NO ROWS SELECTED
IS FALSE
IS NULL
NULL values are treted as which of the following while sorting
Always as first values(regardless of the sorting order)
Always as last values(regardless of the sorting order)
As high values (higher than any existing value)
All the above
an SQL query to fetch “FIRST_NAME” from emp table in upper case.
select upper FIRST_NAME from emp;
select upper( FIRST_NAME) from emp;
select upper_case (FIRST_NAME) from emp;
select * upper(FIRST_NAME) from emp;
An SQL query to print the FIRST_NAME and LAST_NAME from Worker table into a single column COMPLETE_NAME. A hyphen char should separate them.
Select ( FIRST_NAME||'-'|| LAST_NAME) AS COMPLETE_NAME from Worker;
Select (FIRST_NAME '-' LAST_NAME) AS complete_name from Worker;
Select (FIRST_NAME||'-'|| LAST_NAME) AS complete_name from Worker;
Select (FIRST_NAME|'-'| LAST_NAME) AS COMPLETE_NAME from Worker;
An SQL query to show the second highest salary from a table.
Select max(Salary) from Worker where Salary not in (Select max(Salary) from Worker);
Select max(Salary) from Worker where Salary not in (max(Salary));
Select max(Salary) from Worker ;
Select max(Salary) from Worker where Salary not in =Select max(Salary) from Worker)
An SQL query to fetch departments along with the total salaries paid for each of them.
SELECT department, sum(salary) from worker group by Salary;
SELECT (salary) from worker group by DEPARTMENT
SELECT department, (salary) from worker group by DEPARTMENT
SELECT department, sum(Salary) from worker ;
Which operator is used to match text while search?
INTO
IN
SEARCH
LIKE
In Oracle to fetch a TOP N number or X percent records from a table we use
TOP
LIMIT Clause
ROWNUM Clause
None of these
What is a field?
A collection of information
A single item of information
A list of information
A group of records
Using which word allows you to specify that more than one condition must be met in a query?
Also
And
Or
Where
