Question: In this worksheet you will learn how to use SQL as a data definition language ( DDL ) . DDL commands allow you to create,
In this worksheet you will learn how to use SQL as a data definition language DDL DDL commands allow you to create, alter, and drop tables. Selected questions refer you to pages in your textbook that you should study prior to answering the question.
Creating Tables
In creating tables, you must describe each column in the table and specify the data types. We will use the data types listed in Table : Sample Data Types on page For each of the following, select a data type from the table that would be a suitable choice. In some cases, there may be more than one possible choice.
a social security number
b birthday
c twocharacter state abbreviation
d gpa assume decimal place accuracy
e number of dependents
f first name
Look at Figure : SQL Database Definition Commands for Pine Valley Furniture Company, page and answer the following questions. Ref: pages : Creating Tables
a What is the name of the table that stores information about customers?
b What is the name of the primary key constraint for the customer table?
c Can PRODUCTID in the table ORDERLINET be null?
d What is the data type for CUSTOMERID
e What is the name of the primary key constraint for table ORDERLINET
f What are the names of the foreign key constraints for table ORDERLINET
g What attributes make up the primary key for table ORDERLINET
h What attributes make up the foreign key in table ORDERLINET that references table ORDERT
Write the SQL CREATE TABLE command to create two tables named VENDORT and PARTT Attributes for table VENDORT are VendorID primary key VendorName, and PhoneNum. Attributes for table PARTT are PartID primary key PartDesc, QtyOnHand, UnitPrice, and SupplierID foreign key into VENDORT VendorID is a digit code, and PartID is a digit code. VendorName and PartDesc each have a maximum length of characters. Phone number is stored as a digit string. No unit price exceeds $ PartDesc cannot be null. Assume updates cascade and deletes are restricted in VENDORTRef: pages : Creating Tables
If you want to add a column to table PARTT or change an existing column's name, which SQL command do you use? Ref: pages : Changing Table Definitions
Write the SQL command to remove the table PARTT from the database. Ref: page : Removing Tables
Indexing primary andor secondary keys can increase the speed of Ref: page : Internal Schema Definitions in RDBMSs
Dropping indexes can increase the speed of
Write an SQL statement to create an index named CUSTIDX for the CUSTOMERID column of table ORDERT see Figure page for a description of table ORDERT
Write an SQL statement to drop the index you created above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
