Lab 9
Come see me to pick up your MySql Account info
For this lab you will write to a txt file
named lab9.txt. This lab will
consist of a series of questions and code snippet tasks.
- What is a RDBMS?
- What is a Database Schema?
- What is an ER model?
- What is a one to one relationship?
- What is a one to many relationship?
- What is a many to many relationship?
- What is a tuple?
- What is the use for a primary key?
- Why should a primary key be unique?
- What is SQL?
- Write the SQL command that would
create a table called 'Customers' that has
attributes for 'c_id', 'c_firstName', 'c_lastName','c_address',
'c_city', 'c_state', 'c_zip', and 'c_email'. List the 'c_id'
as an integer non null auto incrementing primary key attribute.
- Write the SQL command that would alter the 'Customers' table by
adding a new column for 'c_age' unsigned tiny integer.
- Write the SQL command that would create a table called 'Products'
that has attributes for 'p_id', 'p_title', 'p_description', 'p_price'.
List the 'p_id' as an integer non null auto incrementing
primary key attribute. Set the data type of 'p_price' to decimal(13,4).
- Write the SQL command that would add at least 3 records to
the 'Customers' table.
- Write the SQL command that would add at least 3 records to the
'Products' table.
- Write the SQL command that would create a table called
'Orders' that has attributes for 'o_id', 'o_cid', 'o_amount', 'o_date'.
List the 'o_id' as an integer non null auto incrementing
primary key attribute. Set the data type of 'o_amount' to decimal(13,4).
Set the 'o_date' to an 8 byte data type that holds the
format YYYY-MM-DD HH:MM:SS
- Using the data you've provided for your Customers and Products table,
write the SQL command to add at least 3 records to the 'Orders' table.
- Write the SQL command that would select all of your Customers.
- Write the SQL command that would select all of your Products.
- Write the SQL command that would update one of your Products
price to 49.99.
- Write the SQL command that would select all of your Products that
are less than $100.
- Write the SQL command that would select all Orders where
the order customer id is that of your first Customer.
- Write the SQL command that would select all Orders above $100.
- Write the SQL command that would delete your last Product record.
- Assume there is a table called DropThisTable_GoneForever,
write the SQL command that would drop that table.
Put this file into your
~/3680_S19/wk9/
depository directory, which
I'll extract and copy at the time of the due date.