WorksheetsSimple Queries in SQL
Total questions: 30
Worksheet time: 16mins
Which of the following attributes can be considered as a choice for a primary key?
Name
Street
RollNo
Subject
What does "SQL" stand for?
Structured Question Language
Structured Query Language
Simple Query Language
Simple Question Language
Which statement is used to extract data from a database?
Extract
Get
Open
Select
If you were wanting to filter data, which clause would you use?
Where
Order by
From
Select
Less than or equal to?
>=
=>
=<
<=
Which word is missing from the following SQL statement?
Select * table_name
With
Where
From
And
How do we select all rows for the "Designer" table?
SELECT * FROM Designer
SELECT [All] FROM Designer
SELECT Designer.*
SELECT FROM Designer
How would we script a SQL query to select "Description" from the Item table?
SELECT Item.Description
EXTRACT Description FROM Item
SELECT Item FROM Description
SELECT Description FROM Item
Which query would return only the fields DesignerID and Designer?
SELECT * FROM Designers
SELECT DesignerID, Name FROM Designers
SELECT DesignerID AND Designer FROM Designers
SELECT DesignerID, Designer FROM Designers
How would you display Chairs in the Items table that have a Price greater than £50.
SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50
SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100
SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50
SELECT * FROM Items WHERE Price > 50
Match the following SQL term with a description - ORDER BY
The fields to display
The field and order used to sort the results
The table used in the query
The criteria that must be met
Which symbol would you use to represent more than 50
= 50
< 50
> 50
# 50
When examining a row in a table, we refer to it as a...
row number
result number
record
result
When examining a column in a table, we refer to it as a...
field name
folder name
column number
table name
What would the SQL query pictured do?
Find all the men
Find all of the female writers
Find all of Elgar's friends
Find all the male writers
Find all the fish
The language used application programs to request data from the DBMS is referred to as __________
DDL
DML
Query Language
All of the mentioned
Which of the following is not a type of SQL statement?
Data Manipulation Language (DML)
Data Definition Language (DDL)
Data Control Language (DCL)
Data Communication Language (DCL)
DDL Stands for ___________.
Data Management Language
Data Manupulation Language
Data Development Language
Data Definition Language
Which SQL function is used to find the average value of any column?
Mean()
Avg()
Average()
Sum()
Which would show all fields from the Pupils table?
SELECT * FROM Pupils
SELECT Name, Form FROM Pupils
SELECT * FROM *
SELECT * FROM Forms
Which Symbol means "All"
*
&
%
!
Which would find pupils with "er" anywhere in their name?
SELECT * FROM Pupils Where Name = "%er"
SELECT * FROM Pupils Where Name = "$er$"
SELECT * FROM Pupils Where Name = "%er%"
SELECT * FROM Pupils Where Name = "er%"
Choose the correct query
SELECT * FROM EMP WHERE NAME=NULL
SELECT * FROM EMP WHERE NAME IS NULL;
SELECT FROM EMP WHERE NAME IS NULL;
SELECT *FROM EMP WHERE NAME IS 'NULL';
Which is not an aggregate function?
SUM()
POW()
AVG()
COUNT()
A table T_COUNT has 12 number values as 1, 2, 3, 32, 1, 1, null, 24, 12, null, 32, null. Predict the output of the below query.
SELECT COUNT (*) FROM t_count;
12
6
9
Throws exception because COUNT function doesn't works with NULL values
Consider the following SQL statement. What type of statement is this? SELECT * FROM Employee;
DML
DDL
DCL
TCL
Which of the following query contains error?
SELECT * FROM Emp WHERE Empid=1001;
SELECT Empid FROM Emp WHERE Empid=1001;
SELECT Empid FROM Emp;
SELECT Empid WHERE empid=1001;
Which operator performs pattern matching?
BETWEEN
LIKE
EXISTS
None of These
The pattern '_ _ _' matches any string of ______ three characters, '_ _ _ %' matches any string of ________ three characters.
At least, Exactly
Exactly, At least
At least, All
All, Exactly
