7830TextAnswersCh7

7830TextAnswersCh7 - Chapter Seven SQL For Database...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter Seven SQL For Database Construction and Application Processing Page 7-1 ANSWERS TO REVIEW QUESTIONS 7.1 What does DDL stand for? List the SQL DDL statements. DDL stands for Data Definition Language . DDL statements include: CREATE TABLE ALTER TABLE DROP TABLE 7.2 What does DML stand for? List the SQL DML statements. DML stands for Data Manipulation Language . DML statements include: INSERT UPDATE DELETE 7.3 Explain the meaning of the following expression: IDENTITY (4000, 5). The IDENTITY keyword is used to modify a column name, and is used to specify surrogate keys. The first number parameter after IDENTITY specifies the starting value for the surrogate key, and the second number specifies the increment value for key additional record. Thus a column named RelationID and modified by IDENTITY (4000, 5) will be a surrogate key named RelationID with an initial value of 4000 (for the first record in the relation), and with following values incremented by 5: 4000, 4005, 4010, etc. Use the following three tables in your answers to questions 7.4 to 7.25: EMPLOYEE (EmpNumber , Name, Email) PROJECT (ProjectName , Description, StartDate, EndDate) ASSIGNMENT ( EmpNumber , ProjectName , TotalHoursWorked) Assume that the relationship from EMPLOYEE to ASSIGNMENT is 1:N, M-O and that the relationship from PROJECT to ASSIGNMENT is 1:N, M-O. Answers to review questions 7.4-7.25 appear in the database dbp10_im_ch07_EOQ_RQ.mdb and in SQL format on the Instructor’s Resource CD-ROM or the text’s Web site ( www.prenhall.com/kroenke ).
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter Seven SQL For Database Construction and Application Processing Page 7-2 NOTE: The SQL statements described in this chapter work best with MS SQL Server 2000 – It supports the most keywords, clauses and features described. The SQL Server solutions shown below are the best solutions to the questions asked. For completeness, and so that your students can actually try out their statements in a live DBMS, the MS ACCESS and Oracle solutions are also shown. 7.4 Write a CREATE TABLE statement for the EMPLOYEE table. Use either the SQL Server or Oracle data types shown in Figure 7-4. Assume that Name is required and an alternate key. Email is neither required nor an alternate key. For SQL Server and MS ACCESS: CREATE TABLE EMPLOYEE ( EmpNumber Int NOT NULL, [Name] Char (50) NOT NULL, Email VarChar(100) NULL, CONSTRAINT EMPLOYEE_PK PRIMARY KEY (EmpNumber), CONSTRAINT EMPLOYEE_AK1 UNIQUE ([Name]) ); For Oracle: CREATE TABLE EMPLOYEE ( EmpNumber Integer NOT NULL, Name Char (50) NOT NULL, Email VarChar(100) NULL, CONSTRAINT EMPLOYEE_PK PRIMARY KEY (EmpNumber), CONSTRAINT EMPLOYEE_AK1 UNIQUE (Name) ); 7.5 Write a CREATE TABLE statement for PROJECT. Assume that only ProjectName is required, and that no column is an alternate key. Use the SQL Server or Oracle data types shown in Figure 7-4. For SQL Server and MS ACCESS:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

7830TextAnswersCh7 - Chapter Seven SQL For Database...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online