CTI 110 Lesson 12
What is the purpose of the * character? SELECT * FROM celebs;
It selects every column in the table.
What would be correct syntax for a CREATE TABLE statement?
CREATE TABLE meals ( name TEXT, rating INTEGER );
What does the wildcard character % in the following SQL statement do? SELECT * FROM sports WHERE name LIKE '%ball';
It matches all sports that end with 'ball'.
What is LIMIT?
A clause that lets you specify the maximum number of rows the result set will have.
What is ORDER BY?
A clause that sorts the result set alphabetically or numerically
Which is correct?
A database contains tables and a table contains records and fields
Which is correct?
A database contains tables and a table contains records and fields.
What is a relational database?
A database that organizes information into one or more tables.
What is LIKE?
A special operator that can be used with the WHERE clause to search for a pattern.
Which of the following best describes a RDBMS?
A system to store, manage and use relational databases
What would you need to complete the associated UPDATE statement? UPDATE ________ SET height = 6 WHERE id = 1;
A table name
What is a NULL value?
A value that represents missing or unknown data.
Which clause is used with the ALTER TABLE statement?
ADD COLUMN
Which of the following statements is correct and complete?
DELETE FROM icecream WHERE flavor IS NULL;
What does the INSERT statement do?
Insert new rows into a table.
What are common data types in SQL?
Integer, Text, Date, Real
Find the error in this code: SELECT name, CASE WHEN imdb_rating > 8 THEN 'Oscar' WHEN imdb_rating > 7 THEN 'Good' WHEN imdb_rating > 6 THEN 'Fair' FROM movies;
Missing END statement.
What code would you add to this query to order colors by name alphabetically (Z to A)? SELECT * FROM colors _________________;
ORDER BY name DESC
What is the correct query to select only the cities with temperatures less than 35?
SELECT * FROM cities WHERE temperature < 35;
How would you query all the unique genres from the books table?
SELECT DISTINCT genres FROM books;
What does SQL stand for?
Structured Query Language
IS NULL condition returns true if the field is empty.
True
What is the correct syntax to query both the name and date columns from the database? SELECT __________ FROM album;
name, date
Which of the following is NOT a comparison operator in SQL?
~