IT4300 Practice SQL Quiz (Single File)

Which SQL statement selects all rows from a table called Products and orders the result set by ProductID column?

 SELECT * FROM Products ORDER BY ProductID
 SELECT * FROM Products WHERE ProductID > 200
 SELECT ProductID FROM Products
 SELECT * FROM Products ORDERED BY ProductID

What does follow after the SQL SELECT clause?

 The JOIN SQL clause.
 The name of the table we are selecting from.
 List of columns that will be selected or the * symbol.

If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default:

 ASC
 DESC
 There is no default value.

Which SQL functions is used to count the number of rows in a SQL query?

 NUMBER()
 COUNT()
 SUM()

Which of the following SQL clauses is used to sort a result set?

 ORDER BY
 ARRANGE
 ORDER BY
 SORT

What will be the result of the following SQL statement: SELECT * FROM Table1 HAVING Column1 > 10;

 The result will be empty data set.
 The SQL statement will generate an error.
 The result will be all rows from Table1 which have Column1 values greater than 10.

Which of the following 3 SQL statements is correct?

 SELECT Username, Password FROM Users
 SELECT Username AND Password FROM Users
 SELECT Username, Password WHERE Username = 'user1'

The FROM SQL clause is used to:

 specify range for search condition
 specify search condition
 specify what table we are selecting or deleting data from.

What is the ABS SQL function used for?

  To return the average value of a numeric expression.
  To return the absolute, positive value of a numeric expression.
  To return the maximum value of a numeric expression.
  To return the minimum value of a numeric expression.

What is the difference between the WHERE and HAVING SQL clauses?

  The WHERE and the HAVING clauses are identical
  The WHERE SQL clause condition(s) is applied to all rows in the result set before the HAVING clause is applied (if present). The HAVING clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group.
  The HAVING SQL clause condition(s) is applied to all rows in the result set before the WHERE clause is applied (if present). The WHERE clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group.

What is the purpose of the SQL AS clause?

 The AS clause is used with the JOIN clause only.
 The AS clause defines a search condition.
 The AS SQL clause is used change the name of a column in the result set or to assign a name to a derived column.

What does the SQL FROM clause do?

 Specifies the columns we are retrieving.
 Specifies a search condition.
 Specifies the tables to retrieve rows from.

Which of the following is a SQL aggregate function

 LEN
 JOIN
 LEFT
 AVG

The BETWEEN SQL keywords specifies …

 a range to test in the SQL query search condition.
 a list of values.
 a column list.

What does follow after the SQL WHERE clause?

 The name of the table we are selecting from.
 Definition of the condition to be met for the rows to be returned.
 A list of columns to be selected.

What does the following SQL statement do:

SELECT Customer, COUNT(Order) FROM Sales GROUP BY Customer HAVING COUNT(Order) >5;

 Selects all customers from table Sales that have made more than 5 orders. 
 Selects all Customers from the Sales table 
 Selects the total number of orders from the Sales table, if this number is greater than 5 

Which of the following SQL statements has correct syntax?

 SELECT * FROM Table1 WHERE Column1 = = 10 
 SELECT * FROM Table1 WHERE Column1 => 10 
 SELECT * FROM Table1 WHERE Column1 >= 10 

The AVG SQL function returns the …

 maximum value from a column. 
 the sum of values in a column 
 average in the values in a group. 

What does the FROM SQL keyword specify?

 The FROM SQL keyword specifies a search condition. 
 The FROM SQL keyword specifies a column list. 
 The FROM SQL keyword specifies the tables  used in SELECT. 

What is a primary key?

 The primary key is a column that can have NULL values. 
 The primary key is a column or combination of columns whose values uniquely identify each row in the table. 
 The primary key column is a column or combination of columns whose values can be non-unique. 

What does the term ‘locking’ refer to?

 Locking is a process preventing users from reading data being changed by other users, and prevents concurrent users from changing the same data at the same time. 
 Locking is the process of database authentication. 
 Locking is a process, which logs database usage. 

Can you use both HAVING and WHERE SQL clauses in one SQL statement?

 No. 
 Yes. 

Which of the following SQL statements selects the total number of orders from the Sales table?;

 SELECT AVG(OrderNumber) FROM Sales 
 SELECT COUNT(*) FROM Sales 
 SELECT SUM(OrderNumber) FROM Sales 

RDBMS stands for ‘85

 Relational Database Management System 
 Read Database Master System 
 Really neat Database Management System 

The LIKE SQL keyword is used along with …

 ORDER BY clause. 
 JOIN clause. 
 WHERE clause. 
 GROUP BY clause. 

The BETWEEN SQL keywords specifies …

 a column list. 
 a range to test in the SQL query search condition. 
 a list of values. 

The AVG SQL function returns the …

 maximum value from a column. 
 the sum of values in a column 
 average in the values in agroup. 

Which SQL keyword is used to retrieve a maximum value?

 MOST 
 TOP 
 MAX 
 UPPER 

Which of the following SQL statements will select all records with all their columns from a table called Sales.

 DELETE FROM Sales 
 SELECT * FROM SALES WHERE OrderID < 1 
 SELECT * FROM Sales 

Can you use both SELECT and WHERE SQL clauses in one SQL statement?

 No 
 Yes 

The NULL SQL keyword is used to …

 represent 0 value. 
 represent negative infinity. 
 represent a missing or unknown value. NULL in SQL represents nothing. 
 represent positive infinity. 

What does SQL stand for?

 Structured Query Language. 
 Strict Query Language 
 Strong Query Language 
 Standard Query Language. 

Which of the following SQL statements does count the rows in the ‘Sales’ table?

 SELECT COUNTER(*) FROM Sales 
 SELECT COUNT(*) IN Sales 
 SELECT NUM() FROM Sales 
 SELECT COUNT(*) FROM Sales 

What is a foreign key?

 The foreign key is a SQL locking mechanism. 
 A foreign key is a key field (column) in a database table, which relates the table to another table where the key is a primary key. The primary - foreign key relations are used to cross-reference database tables. 
 The foreign key is a column that can have NULL values. 

Which SQL statement selects all rows from a table called Products and orders the result set by ProductID column?

 SELECT ProductID FROM Products 
 SELECT * FROM Products ORDERED BY ProductID 
 SELECT * FROM Products ORDER BY ProductID 
 SELECT * FROM Products WHERE ProductID > 200 

Which of the following is a SQL aggregate function?

 RIGHT 
 MIN 
 LEFT 
 CAST 

Which of the following statements gets the total value of the column ‘Price’ in the ‘Sales’ table?

 SELECT SUM(Price) FROM Sales 
 SELECT ADD(Price) FROM Sales 
 SELECT SUM(Price) WHERE Sales 
 SELECT TOTAL(Price) FROM Sales 

What is the purpose of the SQL AS clause?

 The AS SQL clause is used change the name of a column in the result     set or to assign a name to a derived column. 
 The AS clause is used with the JOIN clause only. 
 The AS clause defines a search condition.  

Which of the following SQL statements does count the rows in the ‘Sales’ table?

 SELECT COUNTER(*) FROM Sales 
 SELECT COUNT(*) IN Sales 
 SELECT COUNT(*) FROM Sales 
 SELECT NUM() FROM Sales 

What does the following SQL statement do: SELECT Customer, COUNT(Order) FROM Sales GROUP BY Customer HAVING COUNT(Order) >5;

 Selects the total number of orders from the Sales table, if this             number is greater than 5 
 Selects all customers from table Sales that have made more than 5             orders. 
 Selects all Customers from the Sales table 

The table columns are also known as…

 Fields 
 Records 
 Woopals 

Can the SELECT clause list have a computed value like in the example below? SELECT CustomerName, UnitPrice * NumberofUnits FROM Sales;

  Yes. 
  No. 

Which of the following statements gets the total value of the column ‘Price’ in the ‘Sales’ table?

 SELECT SUM(Price) WHERE Sales 
 SELECT ADD(Price) FROM Sales 
 SELECT TOTAL(Price) FROM Sales 
 SELECT SUM(Price) FROM Sales 

Which of the following SQL statements is correct?

 SELECT CustomerName, COUNT(CustomerName) FROM Orders 
 SELECT CustomerName, COUNT(CustomerName) FROM Orders GROUP BY CustomerName 
 SELECT CustomerName, COUNT(CustomerName) FROM Orders ORDER BY CustomerName