SQL Final Questions - Study Guide PDF

Summary

This document is a study guide for a SQL final exam. It includes multiple-choice questions, true/false questions, as well as practice SQL queries.

Full Transcript

You will need to use a database for the queries part of the test, so make sure you have MySQL Workbench open, with the StayWell database selected, prior to beginning the test. 75 points possible for the Test - 30 points possible for Multiple Choice & T/F Questions - 45 points possible for 9...

You will need to use a database for the queries part of the test, so make sure you have MySQL Workbench open, with the StayWell database selected, prior to beginning the test. 75 points possible for the Test - 30 points possible for Multiple Choice & T/F Questions - 45 points possible for 9 Queries to be created and executed You indicate the end of a SQL command by typing a \_\_\_\_. **Semicolon ;** In MySQL, Philip can use the command SELECT \* FROM VACATION\_PACKAGES; to \_\_\_\_\_. **display all rows and columns in the table VACATION\_PACKAGES** A user should be allowed to enter null values for the primary key. **False** To display all the rows and columns in a table, type the word SELECT, followed by a(n) \_\_\_\_\_, followed by the keyword FROM and then the name of the table containing the data you want to view. **Asterisk \*** What code is used in SQL to represent cases in which an actual value is empty, unknown, unavailable, or not applicable? **IS NULL** Which SQL command is used to query a database? **SELECT** What clause can you use to list data in a specific way in the rows? **order by** **SELECT *column1*, *column2, \...*** **FROM *table\_name*** **ORDER BY *column1, column2, \...* ASC\|DESC;** It is possible to use both a WHERE clause and a HAVING clause in a SELECT statement. (**True** - if your query involves groups and rows) *Yes, it is possible to use both a WHERE clause and a HAVING clause in a SELECT statement; the WHERE clause filters individual rows before grouping, while the HAVING clause filters groups based on aggregated values after grouping occurs.* The GROUP BY clause sorts the data in a particular order. **False** *The \"GROUP BY\" clause in SQL is used to group rows together based on similar values in a specified column, not to sort the data in a specific order. To sort data, you need to use the \"ORDER BY\" clause.* Adding an ORDER BY UNIT\_PRICE clause to a SQL query will \_\_\_\_\_. **display the results in ascending order by UNIT\_PRICE** It is possible to place one query inside another. **True** **Nested query - Select inside a select** All SELECT statements require a WHERE clause. **False** Which operator finds rows that do not contain a null value in the specified column? **is not null** Mallory would like to display the rows from a SQL table that have \"Red,\" \"Pink,\" or \"White\" in the COLOR column. A concise way of writing her query would be to use a(n) \_\_\_\_\_. **IN** SELECT \* FROM Customers WHERE Country IN (\'Germany\', \'France\', \'UK\'); Which operator is inclusive, meaning that a query selects a value equal to either value in the condition along with those in the range of the values? **Between** **SELECT \* FROM Products** **WHERE Price BETWEEN 10 AND 20;** Which function determines the number of rows in a table? **Count** **SELECT COUNT(\*)** **FROM Products;** Which operator uses one or more wildcard characters to test for a pattern match? **Like** Wildcard = % SELECT \* FROM Customers WHERE CustomerName LIKE \'a%\'; When you need to find rows with null values in a SQL table, you can use the \_\_\_\_\_. **is null** **SELECT *column\_names*** **FROM *table\_name*** **WHERE *column\_name* IS NULL;** Which function calculates a total of the values in a column? **SUM** **SELECT SUM(Quantity)** **FROM OrderDetails;** The basic form of the SQL SELECT command is \_\_\_\_\_. **SELECT** **FROM** **WHERE** What SQL command do you use to begin a query of a database? **SELECT** The only arithmetic operators that can be used in SELECT statements are + for addition and - for subtraction. **False** **Lots of operators: +,-,\*,/,\

Use Quizgecko on...
Browser
Browser