0% found this document useful (0 votes)
30 views

Act 6 Script

The document creates databases and tables to store student, contact, service, and schedule data. It populates the tables with sample data.

Uploaded by

Drei Sulapas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Act 6 Script

The document creates databases and tables to store student, contact, service, and schedule data. It populates the tables with sample data.

Uploaded by

Drei Sulapas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

SHOW DATABASES;

CREATE DATABASE dtutor;

USE dtutor;

CREATE TABLE student


(
stud_id INT(13) AUTO_INCREMENT PRIMARY KEY,
stud_fname VARCHAR(13) NOT NULL,
stud_lname VARCHAR(13) NOT NULL
);

DESCRIBE student;

CREATE TABLE contact


(
contact_id INT(13) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
con_num INT(13) NOT NULL,
email VARCHAR(13) NOT NULL,
stud_id INT,
CONSTRAINT fk_student
FOREIGN KEY (stud_id)
REFERENCES student (stud_id)
ON DELETE CASCADE
ON UPDATE CASCADE
);

DESCRIBE contact;

CREATE TABLE service


(
serv_id INT(13) AUTO_INCREMENT PRIMARY KEY,
serv VARCHAR(13) NOT NULL,
level VARCHAR(13) NOT NULL,
stud_id INT,
CONSTRAINT fk_student_serv
FOREIGN KEY (stud_id)
REFERENCES student (stud_id)
ON DELETE CASCADE
ON UPDATE CASCADE
);

DESCRIBE service;

CREATE TABLE schedule


(
sched_id INT(13) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
date DATE NOT NULL,
hour INT(13) NOT NULL,
serv_id INT,
CONSTRAINT fk_serv
FOREIGN KEY (serv_id)
REFERENCES service (serv_id)
ON DELETE CASCADE
ON UPDATE CASCADE
);

DESCRIBE schedule;
SHOW TABLES;

INSERT INTO student (stud_fname, stud_lname)


VALUES
('Itchan', 'Sumando'),
('Micheale','Jacksown'),
('Maynard','Caine'),
('Tims','Shaker'),
('Kuku','Palad'),
('Kurt','Cobain'),
('James','Hetfield'),
('Dave','Mustaine'),
('Mike','Dirt'),
('Bruce','Wayne'),
('Clark','Kent'),
('Dave','Grohl'),
('Mustang','Ibanez'),
('Kiko','Magalona'),
('Chito','Miranda'),
('Michael','Myer'),
('Kiko','Laurel'),
('Buwi','Meneses'),
('Perf','Decastro'),
('Kimuel','Exec')
;

SELECT * FROM student;

INSERT INTO contact (con_num, email, stud_id)


VALUES
('48756','[email protected]', '1'),
('25416','[email protected]', '2'),
('36524','[email protected]', '3'),
('82469','[email protected]', '4'),
('36974','[email protected]', '5'),
('85479','[email protected]', '6'),
('25463','[email protected]', '7'),
('25874','[email protected]', '8'),
('15945','[email protected]', '9'),
('36987','[email protected]', '10'),
('15946','[email protected]', '11'),
('25874','[email protected]', '12'),
('15965','[email protected]', '13'),
('12364','[email protected]', '14'),
('12547','[email protected]', '15'),
('98569','[email protected]', '16'),
('25874','[email protected]', '17'),
('15463','[email protected]', '18'),
('25874','[email protected]', '19'),
('15648','[email protected]', '20')
;

SELECT * FROM contact;

INSERT INTO service (serv, level, stud_id)


VALUES
('Lecture', 'Jr HS', '1'),
('Reading', 'Kinder', '2'),
('Lecture', 'College', '3'),
('Reading', 'Kinder', '4'),
('Lecture', 'Elementary', '5'),
('Lecture', 'Sr HS', '6'),
('Facilitate', 'Sr HS', '7'),
('Facilitate', 'College', '8'),
('Lecture', 'College', '9'),
('Reading', 'Elementary', '10'),
('Writing', 'Kinder', '11'),
('Lecture', 'Jr HS', '12'),
('Facilitate', 'Lecture', '13'),
('Reading', 'Elementary', '14'),
('Writing', 'Kinder', '15'),
('Facilitate', 'College', '16'),
('Lecture', 'College', '17'),
('Reading', 'Elementary', '18'),
('Writing', 'Elementary', '19'),
('Lecture', 'College', '20')
;

SELECT * FROM service;

INSERT INTO schedule (date, hour, serv_id)


VALUES
('2020-08-19', '3', '1'),
('2020-08-29', '2', '2'),
('2020-09-13', '6', '3'),
('2020-10-13', '2', '4'),
('2020-10-14', '2', '5'),
('2020-10-15', '3', '6'),
('2020-10-25', '2', '7'),
('2020-10-30', '1', '8'),
('2020-11-01', '4', '9'),
('2020-11-02', '2', '10'),
('2020-11-03', '2', '11'),
('2020-11-15', '4', '12'),
('2020-11-25', '3', '13'),
('2020-12-03', '4', '14'),
('2020-12-10', '3', '15'),
('2020-12-11', '2', '16'),
('2020-12-15', '2', '17'),
('2021-2-4', '4', '18'),
('2021-2-5', '3', '19'),
('2021-2-15', '2', '20')
;

SELECT * FROM schedule;

You might also like