You are on page 1of 2

Table Name Customer

Attributes / Field Name Data type (size) Constraint Cust_Num Char (5) Primary Key Cust_Last Varchar (20) Cust_First Varchar (20) Cust_Address Varchar (30) Cust_city Varchar (15) Cust_state Service_call Call_num Int Primary key Cust_num Int Date Date Tech_num Char (10) Technician Tech_Num Char (10) Primary Key Tech_last Varchar(20) Tech_first Varchar (30) Hire_date Date Figure 1 Write an SQL statement for the statement given below. a) Create a database named Services_Detail. (1 mark) b) Create all the tables as shown above. Add primary keys and for each table. (9 marks) Question 3 (10 MARKS) Based on the Figure 1 in question 1 write the SQL statement for each question below:a) Add 4 new records in table Technician. (4 marks) Tech_Num Tech_last Tech_first Hire_date 04 Robinson Gerry 1-6-1995 09 Whitfield David 1-8-1997 17 Kaplan Carl 1-1-1990 20 Chou Leland 1-12-2001 b) Display Technician number, technician last name, technician first name. (3 marks) c) Delete a Technician record whose last name is Robinson and the first name is Gerry. (3marks) Question 4 (10 MARKS) Table Name Customer Field Name/ Attributes CustNo CustName Age Street Postcode City States PlateNo MileAge RentalRate Model Type Data type (size) Int Varchar (50) Int Varchar (50) Int Char(30) Char (15) Char (10) Int float Char (10) Char (10) Constraints Primary key

Car

Primary key

Rent

PlateNo CustNo StartDate EndDate

Char (10) Int Date Date

Foreign key Foreign key

a) Create a database named Car_rental. (1 marks) b) Add an attribute called PhoneNo which data type is Int in Customer table. (2 marks) c) Add the following new records in Car table. (4 marks) PlateNo MileAge RentalRate JMJ 2100 40000 250.00 WNA 2314 54000 400.00 WSW 5739 20000 500.00 JMS 4521 15000 280.00 Model Proton Saga Honda Civic Grand Livina Perodua Myvi Type Sedan Sedan MPV Compact

d) Update a car records which the plate no is WNA 2314 where the new mile age is 56000. (2 marks) e) Display all data in table rent. (1 mark)

You might also like