WorksheetsSQL BASICS
Total questions: 25
Worksheet time: 9mins
Which one will delete the table data as well as table structure?
DROP
TRUNCATE
ALTER
DELETE
Drag the options into the correct boxes to complete the query
To display the detail of employee having "e" in their name in descending order of salary
SELECT * (a) emp (b) ename (c) %e%" (d) SAL (e) ;
(a) is used to eliminate duplicate values
DDL
ALTER
DML
UPDATE
DCL
REVOKE
TCL
ROLLBACK
Which operator is used to specify the RANGE of values
RANGE from
FROM .. TO
Between .. and
Between range
Reorder the following to get a correct query
display the username and password of all users
select
username
password
from
users
A (a) constraint enforces referential Integrity
A subquery in an SQL SELECT statement is enclosed in:
Braces -- {...}
Single Quotes ' ...'
Parenthesis (...)
brackets [..]
Reorder the following to get the correct order of clauses in select statement.
FROM
WHERE
GROUP BY
HAVING
ORDER BY
Which type of join will automatically find the common column for joining tables?
Inner Join
Equi Join
Outer Join
Natural Join
Pattern matching
Like
Sort the output
Order by
Structure of a table
Desc
Add a new column
Alter
Change the Values
Update
Which of the following queries is valid
SELECT name, course_name FROM student WHERE age>50 and <80;
SELECT name, course_name FROM student WHERE age>50 and age <80;
SELECT name, course_name FROM student WHERE age>50 and WHERE age<80;
None of these
Which of the following is used to delete columns
MODIFY TABLE TableName DROP ColumnName
MODIFY TABLE TableName DROP COLUMN ColumnName
ALTER TABLE TableName DELETE ColumnName
ALTER TABLE TableName DROP COLUMN ColumnName
Consider the following Table.
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 names of all the students whose email ids are not provided?
SELECT first_name, last_name FROM students WHERE email=0;
SELECT first_name, last_name FROM students WHERE email='null';
SELECT first_name, last_name FROM students WHERE email ='NULL'
SELECT first_name, last_name FROM students WHERE email is null;
Find the temperature in increasing order of all cities
SELECT (a) , (b) (c) wheather (d) (e)
In an SQL SELECT statement querying a single table, the asterisk (*) means that:
all records are to be returned.
None the options is correct.
All columns of the table are to be returned
All records meeting the full criteria are to be returned.
Single row function
round
operator
In
aggregate function
min
clause
where
statement
select
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'
------- statement is used to establish an IF-THEN-ELSE in SQL
(a)
Reorder the following for the correct sequence of order of sql select statement.
select
from
where
group by
having
Primary Key
Unique identifier
Unique
allow Null values
Not Null
Don't allow null values
Foreign Key
referential constraint
check
Condition must be true
Which of the following statement is correct regarding the difference between TRUNCATE and DELETE,DROP commands?
DELETE will free the space while TRUNCATE and DROP will not free the space
TRUNCATE and DROP operations can be rolled back but DELETE operations cannot be rolled back.
DELETE and TRUNCATE remove the records but keeps the structure.
DELETE is DDL while TRUNCATE and DROP are DML
Which of the following statement is correct to display all the cities with the condition, temperature, and humidity whose humidity is in the range of 60 to 75 from the 'whether' 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
Alter
Add or remove columns
Update
Modify the existing values
revoke
Remove permission
rollback
Undo the changes
Delete
Remove a record
Which of the following is a valid column name
1year
first year
first.year
year1
