What is the field in the following query?
SELECT name FROM customers;
What is name?
What data type is the following?
"Oregon"
What is the text data type?
Specifies how data is sorted in a results set.
What is the ORDER BY clause?
Available tables and columns:
people: name
Fetch all unique names without missing values.
SELECT DISTINCT name FROM people
WHERE name IS NOT NULL;
What is the table in the following query?
SELECT customer_id, name FROM customers;
What is customers?
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.
In a SQL query, specifies the table that data is selected from.
What is the FROM clause?
% _
What are wild card characters in SQL?
What is another word for a column in a table?
field
What are the two values for Booleans in SQL?
What are True and False?
Selects everything from the Personnel table.
SELECT * FROM Personnel;
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!
What is another word for a row in a table?
record
(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)
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?
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;
Write the query to select names as customer_names from the table named customers.
SELECT names AS customer_names
FROM customers;
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
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
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)