0% found this document useful (0 votes)
28 views18 pages

A1 Database 2k25 2

The document discusses various aspects of databases, including types such as flat and relational databases, and concepts like primary keys, foreign keys, and normalization. It outlines the structure of databases, the roles of database administrators, and the importance of data integrity and security. Additionally, it provides examples of SQL statements for creating, updating, and deleting records in a database.

Uploaded by

huzaifa ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views18 pages

A1 Database 2k25 2

The document discusses various aspects of databases, including types such as flat and relational databases, and concepts like primary keys, foreign keys, and normalization. It outlines the structure of databases, the roles of database administrators, and the importance of data integrity and security. Additionally, it provides examples of SQL statements for creating, updating, and deleting records in a database.

Uploaded by

huzaifa ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

A1 Database , 2k25

There is no reason and no way that a human


mind can keep up with an artificial
intelligence machine by 2035.
DATABASE Registration ER-Diagrams
· Collection of Data items and Links CID + SUB Subcode ·
Entity Relationship diagrams
between them structured
,
in a
way
1009 Maths 9709 >
Anything about which we can

that allows to 1008 CS 9618 -


be accessed
by store data

100% CS 9618 > TABLES


different Applications and Users·

1008 Maths 9709 ONE-TO-ONE

DFLAT DATABASE 8 Consist only one table.


CAR Engine
of
ONE-TO-MANY

② Relational Database : Consist


of multiple tables TEACHER STUDENTS

related to each other


Composite Key : If Primary Key is
depending
MANY TO ONE

Students AST(

DBMS Database Management System fields


. on two or more its called
composite key. MANY TO MANY
KHT CS STDS KHI CS Tech

1- ORACLE 2-MySQL 3-MS-Access


Secondary Key : Candidate
key other than primary key .
> Not
Normalized
· Used
for searching purpose
DBA Database Administratos Normalization

Used in
indexing
·

Person who & Fields Columns Attributes becomes


manages database. Searching FASTER
· Process relational database
of structuring
- ·
.

Student in accordance with series


of normal

StID StName GRNO Address Attendance


forms to reduce data
Redundancy and
.

3001 North FALSE


201
Ayan maintain Data Integrity
y
203 subhan 3009 Gulshan THE ROWS Records
Tuple -
MORE Consistent

Redundancy
-

Reduce .

sCell Foreign Key -

Duplications are removed.

ORDER Dependencies are removed.


-

SHOP
PK
PK
ShopID Product Price OrderID Shopp Quantity
203 Pakol 20 25 203288 ① 1st Normal Form & INF & 3NF
206 APPLE 999 21 208 2
Candidate
Key
· Field Fields which second is 208 IDAD 799 23 203500
for every
or

unique.
o most suitable
field is chosen as
Primary key .

Foreign Key :
Primary key in one table

another table.
Used as
referencing key in

·
Foreign key may not be unique in
referencing
table·
·
Used to Relate two tables-
1st Normal Form DATATYPES IN SQL SQL Statements
Student > Structured Query Language
Sub Mark
StID StName VARCHAR
203 Subhan as 91
Collection Database
Alphanumeric Valves 1
Creating
·

of -
a

Ahmer 201 8 Name of Database


including Special Characters as well.
Hamza
209 CS Go
"Mughees-TCR"
"
Rizwan ·
e
g
.

,
TCR BLOCK E North
, ,
-
"
CREATE DATABASE MAICS
; > End
of
time
operator
> 91 81 , 10
204 UMER CS ,
Statement
Upper
T bound.

VARCHAR(25 .
2
Deleting a Databuse .

> Max No characters.


All should contain relevant data
. of
fields consist of multiple tables
· > .

None the cell should be


empty DROD DATABASE MAKES
·

of ;
· No Repeating Group of attributes INTEGER
· Table should
follow atomicity .
·
Whole Numbers 3 .
Creating a table.

with
fields defined
~
sone cell
,
one value · e .

g 23 , -18, 200 no

Primary Key should be defined .


CREATE TABLE Student ;
ORDER
PK
2NIF Decimal REAL
Numbers Shopp Quantity
·
OrderID
o
Table should be in INF · e 23 18 , -100 19 25 203 288
g
. .
.

21 208 2
No partial Dependency
·

Fields 23 203500
KeyFieldsSTUDENT Now-key
SUBL SubTech DATE
SHID
Campus
. 01
2 Phy YAWAR North ·
#DD/mm/ YYY#
203 maths Salman Gulshan "DD/ mo/YYXY " CREATE TABLE ORDER ONDEND INTEGER
,
201 Maths Salman North

203 Phy YAWAR Gulshan BOOLEAN ShopID INTECER, Quantify INTEGER


,
·
TRUE/FALSE Yes/No , 1/0
,
·
Partial Dependency 8 When a
wonkey field PRIMARY KEY OSdeID),
starts
depending on
only one
of
the key Fields

CHAR(4) FOREIGN KEY (ShopID REFERENCES SHOP(ShopID) ;


3NF 9- 2 NF ·
Fixed Number
of characters
1
-
No Transitive
Dependency - 8 When a
monkey field starts ·
e .

g AB123
PK CAIE
depending on another non
key Field .

RegID Name Sub Code

201 Subhan (S9618

203 Umes maths 9709 HH : Mm : SS' TIME


204 Taka Maths 9709

204 Hamza CS 9618


U -

Deleting A TABLE 6-
Updating a Record -
TABLE
Definition , Other Fields
PK

DROP TABLE ORDER ; UPDATE Student


SET Age = 60 FK
Record table·
5 -

Displaying a or
WHERE SAID = 203 ;

> All records will be


updated. > Name Table Primary Keys
of
F
Deleting Record table
a
from -

Student 0
: Display Title Rating for
StID StName Sub Mark Grade
,
all Movies
displayed on Screens .

Age
DELETE FROM Student
203 Subhan <S 9) "Al 30
WHERE SHD = 203
; SELECT MOVIE .
TiHe , MOVIE -
Rating

~
All fields > All records will be deleted . FROM MOVIE MOVIESCHEDULE
,
Fields SELECT # WHERE MOVIESCHEDULE Screen Number .
= 3
Student ; MOVIE MovielD
Name
of From 8 -

Changes in Table. AND MOVIESCHEDULE MovielD ·


= -

;
Tables. SELECT MOVIE .
TiHe , MOVIE -
Rating
ALTER TABLE Student FROM MOVIE
o
StIDs ,
StName
, Age Mark > 80 ADD PRIMARY KEY SHD ; INNER JOIN MOVIESCHEDULE

ON MOVESCHEDULE MovielD .
= MOVIE MovielD
.

SELECT SHID ,
StName
Age ALTER TABLE Student WHERE MOVIESCHEDULE Screen Number .
= 3
;
,

From Student ADD Address VARCHAR ;


Conditions WHERE Mark Do ;
SHOP
K
ShopID Product Price GROUP BY
o StName Mark >90
, Age < 10 203 Pakol 20
206 APPLE 999
SELECT StName 208 IDAD 799
From Student
HEADING
**
WHERE Mark > 90 AND
Age (10
ORDER BY StName DESC ; SELECT SUM(Price AS TotalSum

ASC9 Descending Order FROM SHOP; ·


·
Age , Stane Mark (50 > Ascending SELECT AVG(Price AS AvgSum
Order Descending Age FROM SHOP;
-

SELECT Age ,
StName SELECT CONNT(ShopID) As POiceAboveloo
From Student FROM SHOP

WHERE Mark < 50 WHERE Price >100


;
ORDER BY Age DESC
;
> Database Structure a Data items stated in

DDL vs DML DATABASE


Referential Integrity Security Features
of
RDBMS

· Data Definition Language · Data


Manipulation Language · Data should be consistent throughout
database Back is maintained ,
.
1-
up of Data
CREATE DATABASE SELECT FROM WHERE an

atregulinter different
·
every Foreign Key has
·
.
·
Ensures a

·
DROP DATABASE ·
ORDER BY corresponding Primary Key .
2 Access
.
OCREATE TABLE · GROUP BY QUERY ·
Makes sure
any queries Run returns Rights
·
DROP TABLE
·
AVG/SUM/COUNT accurate and
Complete .
Results 3
- Each user having different views
ALTER TABLE ·
INNER JOIN ON updated) deleted data
any value
is be
· ·
IF 4- Encryption on can

UPDATE SET WHERE it should be updated/deleted in


applied
·

·
DELETE FROM WHERE Maintenance referencingfables as well. 5 -
Records AND Table Locking
·
INSERT INTO VALUES ·
Prevent simultaneous access

CASCADING UPDATE CASCADING Delete DATA, so that data is


of
DATABASE STRUCTURE Each User having Different View/Access not overwritten -

VIEW VIEW 2 VIEW3 LEVEL I 6 - Tables can be protected with


HR Student USER
Interface
ADMIN
External Level DEVELOPERS INTERRACE username and
passwords .

oused to create
friendly interface
users.
for
LEVEL 2 0 To create
forms ,
to enter data . Ends !:
conceptual conceptuchem · Generate
Reporte .

Level a DBA
Logical Level ·
Internative features Menu's
,
buttons-

OER-Diagrams
2
g TABLES , KEY Fields , attributes ,
.
QUERY PROCESSOR
datatypes . oused .
to search data
·
create areales
INTERNAL LENEL Devices LEVEL3
DATABASE
Storage · Search
for specific records .

can
perform calculations
o

Physical Level HDD/SSD on .


Extracted data

>
Encryption is
Applied DATA
Dictionary
Compression
· ·
MetaData
.

data will be accessed OS.


· How
by ·
It stores
about database.
complete information

of Tables, Fields,
Number
e .

g DataTypes ,
key Fields
, Relationship 6/w Fields
PAGE 986

(c) The following database table is not normalised.

StudentName DateOfBirth TutorGroup


S
Subject
I
C SubjectCode
English, Maths,
Yuwei Chen 01/09/2004 SMH EN, MA, CS
Computer Science
&
Claudia Raj 23/02/2005 JMB Maths, Physics, Art MA, PY, AR
Art, Design, English
Aamil Akram 24/01/2005 KMB AR, DE, EN
-- language
English language,
Areeba Faraz 21/12/2004 SMH EN, CH, DE
=> Chemistry, Design

Explain how to modify the table to put it into First Normal Form (1NF).
·
Subject andSubject Cade having repeating group of attributes ,
...................................................................................................................................................

each cell should have only valuee.


corresponding
...................................................................................................................................................
one

· We can introduce studented as new field so that it can be


...................................................................................................................................................

used
Primary Kay
...................................................................................................................................................
as
.
·
StudentName field should be divided into two fields
...................................................................................................................................................
FirstName and LastName so that one cell
...................................................................................................................................................
e
g
.

should contain only one value.


...................................................................................................................................................

Atomicity should be followed , one cell one value .


............................................................................................................................................. [4]
-

© UCLES 2023
G 9618/12/O/N/23 [Turn over
PAGE 964

3 A shop manager has designed a relational database to store customer orders.

The database will have the following tables:

CUSTOMER(CustomerID, FirstName, LastName, Town)

SHOP_ORDER(OrderNo, CustomerID, OrderDate)

SUPPLIER(SupplierID, EmailAddress, TelephoneNumber)

ITEM(ItemNumber, SupplierID, Description, Price)

O
-

ORDER_ITEM(ItemNumber, OrderNo, Quantity)

(a) Complete the entity-relationship (E-R) diagram for the relational database.

SHOP_ORDER CUSTOMER

ORDER_ITEM SUPPLIER

ITEM

[3]

(b) Identify three advantages of a relational database compared to a file-based approach.

Complex SearchPrevies can te executed.


1 ................................................................................................................................................

...................................................................................................................................................

, regular backups
More Secure are maintained.
2 ................................................................................................................................................

...................................................................................................................................................

Data Redundancy isdeduced less


duplication of data .
3 ................................................................................................................................................
,

...................................................................................................................................................
[3]

© UCLES 2023 9618/11/O/N/23


PAGE 965

(c) (i) Write a Structured Query Language (SQL) script to define the database called SHOP.

CREATE DATABASE SHOP


;
...........................................................................................................................................

..................................................................................................................................... [1]
sum
(ii) Write the SQL script to return the total quantity of items that the customer with the ID of
HJ231 has ordered.

...........................................................................................................................................

SELECT SUMJORDER-ITEM Quantify As Total


Quantily
...........................................................................................................................................
.

FROM ORDER-ITEM , SHOP-ORDER


...........................................................................................................................................

WHERE SHOP-ORDER . CustomsID = "HJ231"


...........................................................................................................................................

AND SHOP-ORDER OOMNO = ORDER-ITEM OrdeNO


...........................................................................................................................................
. .

;
..................................................................................................................................... [4]

© UCLES 2023 9618/11/O/N/23 [Turn over


PAGE 942

(c) The database Lessons has the following tables:

HORSE(HorseID, Name, Height, Age, HorseLevel)

STUDENT(StudentID, FirstName, LastName, RiderLevel, PreferredHorseID)

LESSON(LessonID, Date, Time, StudentID, HorseID, LessonContent)

Dates in this database are stored in the format #DD/MM/YYYY#.

The fields RiderLevel and HorseLevel can only have the values: Beginner,
Intermediate or Advanced.

(i) Describe two methods of validating the field RiderLevel.

1 ........................................................................................................................................

...........................................................................................................................................


...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(ii) Write a Structured Query Language (SQL) script to return the names of all the horses
that have the horse level intermediate or beginner.
S
...........................................................................................................................................

SELECT Name
...........................................................................................................................................

FROM HORSE
...........................................................................................................................................

WHERE House Level = "Intermediate"


...........................................................................................................................................

OR Horselevel = "Beginner" ;
...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2023 9618/12/M/J/23


PAGE 943

7
T
(iii) The following SQL script should return the number of riders that have the rider level
beginner and have a lesson booked on 09/09/2023.
--L
SELECT SUM(STUDENT.RiderLevel) AS NumberOfRiders

vFROM STUDENT, LESSON

WHERE StudentID = StudentID

OR Date = #09/09/2023#
>

AND STUDENT.RiderLevel = Beginner;

There are four errors in the script.

Identify and correct each error.

SUM (STUDENT Rides Level) should be


1 ........................................................................................................................................
·

COUNT (STUDENT StudentID ·


...........................................................................................................................................

StudentID =
StudentID
2 ........................................................................................................................................

STUDENT StudentID =
LESSON StudentID
...........................................................................................................................................
.
.

OR Date
3 ........................................................................................................................................

AND LESSON . Date


...........................................................................................................................................

Beginner "Beginner"
4 ........................................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2023 9618/12/M/J/23 [Turn over


MUHAMMAD ALI KHAN
PAGE 899

5 A relational database, GARDEN, has the following tables:

OWNER(OwnerID, FirstName, TelephoneNo, TreeID, TreePosition)


V - L L
TREE(TreeID, ScientificName, MaxHeight, FastGrowing)

(a) The database is not in Third Normal Form (3NF).

Explain how the database can be normalised to 3NF.


each other,
· TreelD and Treeposition are
depending they
...................................................................................................................................................
on

are non
key fields In OWNER Table We can create a
...................................................................................................................................................
. .

newfable called OWNER-TREE having OwnerID and TreeID


...................................................................................................................................................

as
primary key fields . No Transitive
dependency no
...................................................................................................................................................
,

to relation between the tables.


many many
...................................................................................................................................................

............................................................................................................................................. [3]

(b) Write the Structured Query Language (SQL) script to add a new record in the table TREE to
store the following data:

Attribute Value

TreeID V LOW_1276

ScientificNameL Salix_Alba
-
MaxHeight - 30.00
-
FastGrowing TRUE

...................................................................................................................................................

INSERT INTO TREE


...................................................................................................................................................

VALUES "LOW-1276" "Salix-Alba" 30 00 , TRUE ;


...................................................................................................................................................
,
.

............................................................................................................................................. [3]

(c) State what is meant by a candidate key in a relational database.


· Field/Fields
for which eachrecord is unique Field/Fields
...................................................................................................................................................
,

are candidates
for becoming Primary key
.
............................................................................................................................................. [1]

© UCLES 2022 9618/12/O/N/22 [Turn over


MUHAMMAD ALI KHAN
PAGE 871

4 A photographer creates a relational database to store data about photographs taken at birthday
parties.

The database, PHOTOGRAPHS, stores details of the customer, the party, the photographs taken
and the cameras used.

The photographer has several cameras that are used for taking the photographs at the parties.

Each camera has a specific lens type (for example, XY32Z) and lighting type (for example, F1672).

Data about each photograph is stored in the database including the party at which it was taken,
the time it was taken and the camera used.

The database has these four tables:

CUSTOMER(CustomerID, FirstName, LastName, Telephone)

PARTY(PartyID, CustomerID, PartyDate, StartTime)

-
-

PHOTO_DATA(PhotoID, PartyID, TimeTaken, CameraID)

CAMERA_DATA(CameraID, LensType, LightingType)

(a) Complete the entity-relationship (E-R) diagram for the database PHOTOGRAPHS.

PARTY CUSTOMER

PHOTO_DATA CAMERA_DATA

[3]

© UCLES 2022 9618/11/O/N/22


PAGE 872

(b) The database is normalised and is in Third Normal Form (3NF).

Describe the characteristics of a database that is in Third Normal Form (3NF).


· No
Repeating Gromp of
attributes each cell should have
, only
...................................................................................................................................................

one
corresponding value .
...................................................................................................................................................

No Partial
Dependency , If primacy key consist of
·
more
...................................................................................................................................................
than one
field all mon
key fields should only depend an
...................................................................................................................................................
,

primary Key Fields No Transitive Dependency non key


"
...................................................................................................................................................
. ,

field should not depend another non-key field


.............................................................................................................................................
on - [3]

(c) The table shows some sample data for the table PHOTO_DATA.

O PhotoID PartyID TimeTaken CameraID

ST23-56 BD987 08:34 NIK-02

ST23-57 BD987 08:55 NIK-02

ST23-60 BC08 09:01 CAN-01

ST23-61 BC08 10:23 CAN-12

ST23-62 BC08 10:56 NIK-01

(i) State what is meant by a tuple. Give an example of a tuple from PHOTO_DATA.

Row in a fable.
A single
Tuple .................................................................................................................................

...........................................................................................................................................

Example ............................................................................................................................

...........................................................................................................................................
[2]

(ii) Complete the Structured Query Language (SQL) script to display the total number of
photographs that have been taken using a camera with a camera ID starting with CAN.

COUNT
SELECT ........................................................ PhotolD
(................................................................)

PHOTO- DATA
FROM .........................................................................................
"
"CAN *
WHERE CameraID LIKE .................................................................................. ;
[4]

© UCLES 2022 9618/11/O/N/22 [Turn over


PAGE 828

4 A teacher uses a relational database, MARKS, to store data about students and their test marks.

The database has the following structure:


#K
STUDENT(StudentID, FirstName, LastName)
-

Pl
TEST(TestID, Description, TotalMarks)

i
-

STUDENT_TEST(StudentID, TestID, Mark)

(a) Describe the advantages of using a relational database compared to a file-based approach.
· Each table is secure With Username and Password.
...................................................................................................................................................

Referential Integrity in maintained Consistent


...................................................................................................................................................
·

·
Data integrity is maintained Accurate.
...................................................................................................................................................
·
Different Access Rights for each user. Different views
...................................................................................................................................................

Regular
·
Back up
...................................................................................................................................................
.

o
Reductancy is reduced.
...................................................................................................................................................
O

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) Give the highest level of Normal Form (NF) the database MARKS is in and justify your choice.

3NE
Normal Form .............................................................................................................................
No ·
Repeating Group o attributes All / primary keys
Justification ...............................................................................................................................
are

available
...................................................................................................................................................
No Partial
Dependency No Transitive
Dependency
·
...................................................................................................................................................
,
-

[3]

© UCLES 2022 9618/11/M/J/22 [Turn over


MUHAMMAD ALI KHAN
PAGE 829

(c) (i) Sample data to be stored in the table STUDENT_TEST is shown.

000 StudentID

12
TestID

A1
Mark

50

12 P10 100

13 A1 75

14 P10 60

Write a Structured Query Language (SQL) script to create the table STUDENT_TEST.

...........................................................................................................................................

CREATE TABLE STUDENT TEST StudentID INTEGER,


...........................................................................................................................................
-

TestID VARCHAR , Mark INTEGER,


...........................................................................................................................................

PRIMARY KEY StudentID TestID)


...........................................................................................................................................
, ,
FOREIGN KEY (StudentID) REFERENCES STUDENTI StudentIt)
...........................................................................................................................................
,

FOREIGN KEY (TestID) REFERENCES TEST (TesHD) ;


...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [5]

(ii) Write a Structured Query Language (SQL) script to find the average mark of students in
test A7.

...........................................................................................................................................

SELECT Ava Mark) AS


AverageMark
...........................................................................................................................................
FROM STUDENT TEST
...........................................................................................................................................
-

WHERE TestID "A7"


;
=
...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

© UCLES 2022 9618/11/M/J/22


MUHAMMAD ALI KHAN
PAGE 805

10

6 A shop sells plants to customers. The shop manager has a relational database to keep track of the
sales.

The database, PLANTSALES, has the following structure:

PLANT(PlantName, QuantityInStock, Cost)

CUSTOMER(CustomerID, FirstName, LastName, Address, Email)

PURCHASE(PurchaseID, CustomerID)

PURCHASE_ITEM(PurchaseID, PlantName, Quantity)

(a) The database is normalised.

(i) The table lists the following three stages of normalisation:

• The first stage is from a database that is not normalised (0NF) to First Normal Form
(1NF).
• The second stage is from 1NF to Second Normal Form (2NF).
• The third stage is from 2NF to Third Normal Form (3NF).

Tick ( ) one box in each row to identify the appropriate stage for each task.

Normalisation stage
Task
0NF to 1NF 1NF to 2NF 2NF to 3NF

Remove any partial key dependencies V

Remove any repeating groups of attributes


-

Remove any non-key dependencies -

[2]

(ii) Draw an entity-relationship (E-R) diagram for the database PLANTSALES.

PLANT CUSTOMER

PURCHASE_ITEM PURCHASE

[3]
© UCLES 2021 9618/12/O/N/21
PAGE 806

11

(b) The shop manager uses a Database Management System (DBMS).

Describe the purpose and contents of the data dictionary in the DBMS.

...................................................................................................................................................

T
...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) The shop manager uses both Data Definition Language (DDL) and Data Manipulation
Language (DML) statements to create and search the database.

(i) Complete the DML statements to return the total number of items purchased with the
=
purchase ID of 3011A.
- -

Quantity
SELECT SUM(..................................................)

PURCHASE-ITEM
FROM ..................................................

Prochase ID
WHERE .................................................. "3011A"
= ..................................................;
[4]

(ii)
oo
Write DDL statements to include a field in the table PURCHASE to store the date of the
order.

...........................................................................................................................................

ALTER TABLE PURCHASE


...........................................................................................................................................

ADD Date OfOrder DATE ;


...........................................................................................................................................

..................................................................................................................................... [3]

© UCLES 2021 9618/12/O/N/21 [Turn over


MUHAMMAD ALI KHAN
PAGE 747

G
(c) Example data from the table RENTAL are given:

o RentalID
1
CustomerID
22
HouseID
15B5L
MonthlyCost
1000.00
DepositPaid
Yes
2 13 3F 687.00 No
3 1 12AB 550.00 Yes
4 3 37 444.50 Yes

(i) Complete the following Data Definition Language (DDL) statement to define the table
RENTAL.

TABLE
CREATE ...................................... RENTAL
...................................... (

I RentalID INTEGER NOT NULL,

CustomerID INTEGER NOT NULL,

VARCHAR
HouseID ...................................... (5) NOT NULL,

REAL
MonthlyCost ...................................... NOT NULL,

DepositPaid BOOLEAN NOT NULL,

PRIMARY KEY
.......................................................... (RentalID)

);
[4]

(ii) Write a Data Manipulation Language (DML) script to return the first name and last name
of all customers who have not paid their deposit.

SELECT CUSTOMER FirstName CUSTOMER LastName


...........................................................................................................................................
.
, .

FROM CUSTOMER
...........................................................................................................................................

INNER JOIN RENTAL


...........................................................................................................................................

ON CUSTOMER CustomerID .
= RENTAL CustomID
...........................................................................................................................................
.

RENTAL Paid = No
WHERE Deposite ;
...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/12/M/J/21 [Turn over

You might also like