Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use SQL Data Definition Language to create the following Bank-Customer database

ID: 3878086 • Letter: U

Question

Use SQL Data Definition Language to create the following Bank-Customer database You should properly define primary keys and foreign keys with other 8 unique integrity constraints of different kinds. Submit proper DDL and DML statements with all integrity constraints in boldface. Account Bank BH Name Citv B1 England London B2 America New York B3 Royal Toronto B4 France Paris C#B# Balance C1 B1 1000 C1 B2 2000 C1 B3 3000 C1 B4 4000 C2 B 2000 C2 B2 3000 C2 B3 4000 C3B 3000 C3 B2 4000 C4 B 4000 C4 B2 5000 Customer Cf NameAge City C1 Adams C2 Blake C3 Clarlk C4 Your Lastname 20 Ottawa C5 Smith 20 on 0 Paris aris 30 Toronto

Explanation / Answer

# Creating table bank by applying constraint on 3 attributes. The applied constraint are NOT NULL and Primary Key.

CREATE TABLE Bank

(

               B#                                        VARCHAR(4),

               Name                                  VARCHAR(25) NOT NULL,

               City                                      VARCHAR(15) NOT NULL,

               PRIMARY KEY (B#)

);

# Creating table Customer constraint on 4 attributes. The applied constraint are NOT NULL, Primary Key and CHECK.

CREATE TABLE Customer

(

               C#                                        VARCHAR(10),

               Name                                  VARCHAR(20) NOT NULL,

               Age                                      INTEGER(2) NOT NULL,

               City                                      VARCHAR(15) NOT NULL,

               PRIMARY KEY (C#),

               CHECK (Age >= 18)

);

# Creating table Account by applying constraint on 3 attributes. The applied constraint are Primary Key, NOT NULL and Foreign Key.

CREATE TABLE Account

(

               C#                                        VARCHAR(10),

               B#                                        VARCHAR(4),

               Balance                               INTEGER(10) NOT NULL,

               PRIMARY KEY (C#, B#),

               FOREIGN KEY (C#) REFERENCES Customer (C#),

               FOREIGN KEY (B#) REFERENCES Bank (B#)

);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote