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 (
address_id smallint unsigned NOT NULL AUTO_INCREMENT,
address varchar(50) NOT NULL,
address2 varchar(50) DEFAULT NULL,
district varchar(20) NOT NULL,
city_id smallint unsigned NOT NULL,
postal_code varchar(10) DEFAULT NULL,
phone varchar(20) NOT NULL,
location geometry NOT NULL /*!80003 SRID 0*/,
last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (address_id)
);
CREATE TABLE customer (
customer_id smallint unsigned NOT NULL AUTO_INCREMENT,
store_id tinyint unsigned NOT NULL,
first_name varchar(45) NOT NULL,
last_name varchar(45) NOT NULL,
email varchar(50) DEFAULT NULL,
address_id smallint unsigned NOT NULL,
active tinyint(1) NOT NULL DEFAULT '1',
create_date datetime NOT NULL,
last_update timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (customer_id)
);
CREATE TABLE staff (
staff_id tinyint unsigned NOT NULL AUTO_INCREMENT,
first_name varchar(45) NOT NULL,
last_name varchar(45) NOT NULL,
address_id smallint unsigned NOT NULL,
picture blob,
email varchar(50) DEFAULT NULL,
store_id tinyint unsigned NOT NULL,
active tinyint(1) NOT NULL DEFAULT '1',
username varchar(16) NOT NULL,
password varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (staff_id)
);
CREATE TABLE store (
store_id tinyint unsigned NOT NULL AUTO_INCREMENT,
manager_staff_id tinyint unsigned NOT NULL,
address_id smallint unsigned NOT NULL,
last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (store_id)
);
Write code in main.sql Initialize.sql ( read

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!