Data Types
SQL Clauses
JOINS
Troubleshooting
Miscellaneous
100
A column that stores menu price could be set to this data type.

numeric, decimal, smallmoney or money

100

This SQL clause allows you to list the fields you want to see in the results.

SELECT
100

A join type that will pull records from one table that having matching tables on the joining table.

INNER JOIN

100

SELECT order_id, order_date, product_id

FROM Orders inner join OrderItems on Orders.order_id = OrderItems.order_id results in an "ambigous column error". What is the fix?

The field order_id needs a table specified in the SELECT list. ex. Orders.order_id or OrderItems.order_id.
100

What property allows you to auto-generate a numeric primary key?

Identity Specification

200

A column that stores zip code would be best set to this data type. 

varchar or another string data type to help hold leading 0

200

This SQL clause allows you to show the tables where you are retrieving the data.

FROM

200
They keyword that allows you to indicate what fields to join from the two tables listed.

ON

200

They query, SELECT * FROM Products inner join Brands on Products.product_id = Brands.brand_id, has the wrong results. What is the fix?

the linking field must be the PK/FK that joins both tables. products.brand_id = brands.brand_id

200
What is a field that uniquely identifies the records in a table?

Primary Key

300

A column that stores date of birth would be best set to this data type.

date

300

This clause allows you to add criteria to an aggregate function field.

HAVING

300
What is missing from this FROM clause? 

FROM Orders Inner Join OrderItems

ON Orders.OrderID = OrderItems.OrderID

300

SELECT customer_id, COUNT(order_id)

FROM orderitems

results in an error, what is the fix?

Add a group by statement for customer_id.

300

When joining tables, a primary key on one table will link to what type of field on another table?

Foreign key

400

A column that is tracking when an order is placed would be best set to this data type.

datetime

400

This clause allows you to sort your data that is output.

ORDER BY

400

How do you fix this FROM clause? 

FROM Orders, OrderItems

FROM Orders Inner Join OrderItems on Orders.OrderID = OrderItems.OrderID

400

INSERT INTO Customer (CustLast, CustFirst)

VALUES ('Mouse', 'Mickey','mm@gmail.com') results in the error, why?

column count does not match count of values being input, need to remove email address in values list

400

A database object that stores data is called a ____.

table

500

A column that is storing the quantity of pizzas that are ordered would be best set to this data type.

tinyint, (int and small int would get 1/2 points)

500

This clause is required when using an aggregate function field, but you include non-aggregate fields in your SELECT list.

GROUP BY

500

What type of fields do you join between tables?

Primary Key and Foreign Key

500

Want to delete all the customers from OH. Run this statement, DELETE * FROM Customers. What is the problem?

Deletes everything. Need to add a WHERE State = 'OH'

500

A diagram that illustrates the data model of a database is called ________.

E-R diagram/entity relationship diagram

M
e
n
u