Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP DATABASE IF EXISTS store;
- CREATE DATABASE store;
- USE store;
- CREATE TABLE Discs (
- DiscId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
- Album VARCHAR(255) NOT NULL,
- Price FLOAT(3,2) NOT NULL,
- PRIMARY KEY (DiscID)
- );
- CREATE TABLE Customers (
- CustomerId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
- Name VARCHAR(255) NOT NULL,
- Album VARCHAR(255) NOT NULL,
- Copies INTEGER,
- PRIMARY KEY (CustomerId),
- CONSTRAINT FKC1
- FOREIGN KEY FKalbum (Album)
- REFERENCES Discs (DiscID)
- ON DELETE CASCADE
- ON UPDATE CASCADE
- );
- INSERT INTO Discs (Album, Price) VALUES ("Big Booty", 23.94);
- INSERT INTO Discs (Album, Price) VALUES ("Empires", 40.00);
- INSERT INTO Customers (Name, Album, Copies) VALUES ("Joe", "motown", 12)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement