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 INTEGER UNSIGNED 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 VALUES (1, "Big Booty", 23.94);
- INSERT INTO Discs VALUES (2, "Empires", 40.00);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement