Basic DB
Data Types and More
Queries
Wild Cards and More
100

What is the field in the following query?

SELECT name FROM customers;

What is name?

100

What data type is the following?

"Oregon"

What is the text data type?

100

Specifies how data is sorted in a results set.

What is the ORDER BY clause?

100

Available tables and columns: 

people: name

Fetch all unique names without missing values.

SELECT DISTINCT name FROM people

WHERE name IS NOT NULL;

200

What is the table in the following query?

SELECT customer_id, name FROM customers;

What is customers?

200

How can you tell if data is a text data type?

Most of the time you can tell because it is made up of words, or at least has letters included in it. You won't always see quotation marks, but sometimes the tables will show them too.

200

In a SQL query, specifies the table that data is selected from.

What is the FROM clause?

200

%  _

What are wild card characters in SQL?

300

What is another word for a column in a table?

field

300

What are the two values for Booleans in SQL?

What are True and False?

300

Selects everything from the Personnel table.

SELECT * FROM Personnel;

300

Would the following query select the location "Lounge in hotel"? Why?

SELECT * FROM crime_scene

WHERE location LIKE "%Lounge";

No because the wildcard (%) is set up to check for letters or words in FRONT of "Lounge", not behind it!

400

What is another word for a row in a table?

record

400

(Select all that apply) Which of the following select the condition that is true?

a. SELECT * FROM objects

    WHERE colorful IS TRUE;

b.  SELECT * FROM objects

    WHERE colorful = 1;

c. SELECT * FROM objects

    WHERE colorful = 0;

What are 

a. SELECT * FROM objects

    WHERE colorful IS TRUE;

b.  SELECT * FROM objects

    WHERE colorful = 1;


Remember that 1 is TRUE and 0 is FALSE (just like in Python)

400

Allows you to check a data list to see if what you are looking for is included.

What does IN allow you to do in SQL?

400

Available tables and columns:

people: id, name

Fetch all of the people whose name starts with K (uppercase) and ends with a (lowercase) and order the results by the names in descending order.

SELECT * FROM people

WHERE name LIKE "K%a"

ORDER BY name DESC;

500

Write the query to select names as customer_names from the table named customers.

SELECT names AS customer_names 

FROM customers;

500

What is the format for writing dates in SQL?

a. 'YYYY-MM-DD'

b. 'YYYY-DD-MM'

c. 'MM-DD-YYYY'

d. 'DD-MM-YYYY'

What is a. 'YYYY-MM-DD'

ex: 

SELECT id FROM games

WHERE date NOT BETWEEN '2022-12-31' OR '2023-03-20'

ORDER BY date DESC

500

What WHERE clause will select weight values between 2000 and 3000?

WHERE Weight is between 2000 and 3000

WHERE Weight > 1999 and Weight < 3001  

WHERE Weight >= to 2000 and Weight <=3000 

500

What are 5 keywords that can be used in a WHERE clause?

where name 'IS' 'NOT' 'NULL' 'OR' name = "Jorge" 'AND' age 'BETWEEN' 18 'AND' 36 'OR' age 'IN' (14, 48, 65)