Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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) QUESTIONS 3, 4, 5, 6 and 7 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE STAFF ENUM DECIMAL (12) NOT NULL Staff employee number FNAME VARCHAR(50) NOT NULL, / First name LNAME VARCHAR (50) NOT NULL 7. Last name DOD DATE NULL. 1 Date of birth CONSTRAINT SZAFF_PKEY PRIMARY KEY (ENUM) : CREATE TABLE DRIVER ENUM DECIMAL (12) NOT NULL 7. 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 (LINUM). CONSTRAINT DRIVER FKEY FOREIGN KEY (ENUM) REFERENCES STAPE IENUM). CONSTRAINT DRIVER STATUS CHECK STATUS IN ("AVAILABLE", IN SERVICE, ON LEAVE >> CREATE TABLE TRUCKA REGNUM VARCHAR(10) NOT NULL, Registration number CAPACITY DECIMAL (7) NOT NULL, /* Capacity WEIGHT DECIMAL (7) NOT NULL Weight STATUS VARCHAR(10) NOT NULL, 7 Present status CONSTRAINT TRUCK PREY PRIMARY KEY REGNUM), CONSTRAINT TRUCK STATUS CHECK STATUS IN "AVAILABLE", USED, MAINTAINED). CONSTRAINT TRUCK_WRIGHT 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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

107 MA ammeter 56 resistor ? V voltmeter

Answered: 1 week ago

Question

Generally If Drug A is an inducer of Drug B , Drug B levels will

Answered: 1 week ago

Question

1. Explain why evaluation is important.

Answered: 1 week ago