Question: Write code in main.sql Initialize.sql ( read online no edit ) : - - Drop all existing tables DROP TABLE IF EXISTS address, customer, staff,
Write code in main.sql
Initialize.sql read online no edit:
Drop all existing tables
DROP TABLE IF EXISTS address, customer, staff, store, phone;
Create address, customer, staff, and store tables
CREATE TABLE address
addressid smallint unsigned NOT NULL AUTOINCREMENT,
address varchar NOT NULL,
address varchar DEFAULT NULL,
district varchar NOT NULL,
cityid smallint unsigned NOT NULL,
postalcode varchar DEFAULT NULL,
phone varchar NOT NULL,
location geometry NOT NULL SRID
lastupdate timestamp NOT NULL DEFAULT CURRENTTIMESTAMP ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY addressid
;
CREATE TABLE customer
customerid smallint unsigned NOT NULL AUTOINCREMENT,
storeid tinyint unsigned NOT NULL,
firstname varchar NOT NULL,
lastname varchar NOT NULL,
email varchar DEFAULT NULL,
addressid smallint unsigned NOT NULL,
active tinyint NOT NULL DEFAULT
createdate datetime NOT NULL,
lastupdate timestamp NULL DEFAULT CURRENTTIMESTAMP ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY customerid
;
CREATE TABLE staff
staffid tinyint unsigned NOT NULL AUTOINCREMENT,
firstname varchar NOT NULL,
lastname varchar NOT NULL,
addressid smallint unsigned NOT NULL,
picture blob,
email varchar DEFAULT NULL,
storeid tinyint unsigned NOT NULL,
active tinyint NOT NULL DEFAULT
username varchar NOT NULL,
password varchar CHARACTER SET utfmb COLLATE utfmbbin DEFAULT NULL,
lastupdate timestamp NOT NULL DEFAULT CURRENTTIMESTAMP ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY staffid
;
CREATE TABLE store
storeid tinyint unsigned NOT NULL AUTOINCREMENT,
managerstaffid tinyint unsigned NOT NULL,
addressid smallint unsigned NOT NULL,
lastupdate timestamp NOT NULL DEFAULT CURRENTTIMESTAMP ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY storeid
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
