Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

page 2: QUESTION 4 (10 marks) Write the data manipulation statements of SQL that modify the contents of a database listed on page 2 of

image text in transcribed
page 2:
image text in transcribed
QUESTION 4 (10 marks) Write the data manipulation statements of SQL that modify the contents of a database listed on page 2 of this lab task in the ways described below. Note that you are not allowed to modify and/or to drop any consistency constraints. Also note that to implement some of the modifications listed below, you may need more than one data manipulation statement (1) (2) (3) A new trip has been completed today. The trip was from Sydney to Newcastle. The trip has been performed by the driver with the licence number 104777 (column LNUM in a relational table TRIP) who used the truck with registration number AOR84H. Insert the appropriate information into the sample database assuming the next trip number is 10245. (2 marks) Delete the information from the database about trip number 61. Remember, that the foreign keys in all CREATE TABLE statements have no ON DELETE CASCADE clause. (2 marks) Change the status of all the drivers who have performed more than 100 trips to on ON LEAVE. (2 marks) Copy information about all staff born before the year 2000 to a new table STAFF2OCENT. There is no need to enforce any consistency constraints on the new table. (2 marks) Explain how the data manipulation statements of SQL are used in data management and security. Use original examples to illustrate your answer. (2 marks) (4) (5) Submit your answer as a file question4.sql and question4.pdf using the templates provided. Add your name, student number and the date to the comments section of your SQL script. CREATE TABLE STAFF ENUM DECIMAL (12) NOT NULL, /* Staft employee number ENAME VARCHAR (50) NOT NULL, First name LNAME VARCHAR (50) NOT NULL, Last name DOR DATE NULL, Date of birth CONSTRAINT STAFF_PKEY PRIMARY KEY (ENUM)); CREATE TABLE DRIVER ( ENUM DECIMAL (12) NOT NULL, Staff employee number LNUM DECIMAL (8) NOT NULL, Driving license number STATUS VARCHAR(10) NOT NULL Driver status CONSTRAINT DRIVER_PKEY PRIMARY KEY (ENUM), CONSTRAINT DRIVER UNIQUE UNIQUE (LNUM). CONSTRAINT DRIVER FKEY FOREIGN KEY CENUM REFERENCES STAFF (ENUM), CONSTRAINT DRIVER STATUS CHECK STATUS IN AVAILABLE", "IN SERVICES, ON LEAVE'>> ): CREATE TABLE TRUCK REGNUM VARCHAR(10) NOT NULL, Registration number CAPACITY DECIMAL (7) NOT NULL, 1. Capacity WEIGHT DECIMAL (7) NOT NULL, Weight STATUS VARCHAR(10) NOT NULL, 1. Present status CONSTRAINT TRUCK_PKEY PRIMARY KEY (REGNUM), CONSTRAINT TRUCK_STATUS CHECK STATUS IN ("AVAILABLE", USED", "MAINTAINED' ) ), CONSTRAINT TRUCK_WEIGHT CHECK ( WEIGHT > 0.0 AND WEIGHT 0.0 AND CAPACITY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

What are the components of a sound business model?

Answered: 1 week ago

Question

Verify the results in Eqs. (11.99) and (11.100).

Answered: 1 week ago

Question

5. Who should facilitate the focus group?

Answered: 1 week ago