1. Using the same tables you made last week 2. Add to each, a new column (field)
ID: 3751865 • Letter: 1
Question
1. Using the same tables you made last week
2. Add to each, a new column (field). Not new data, and additional field
3. Make sure you fun this create5.sql program
4. Submit the program.
5. Submit a program called list5.sql also
Program Below:
DROP TABLE student;
DROP TABLE teacher;
DROP TABLE school;
DROP TABLE course;
DROP TABLE guardian;
CREATE TABLE student (student_id text, first_name text, last_name text, age int);
CREATE TABLE teacher (first_name text, last_name text, subjects text);
CREATE TABLE school (name text, students_count int, state text);
CREATE TABLE course (course_id text, name text, credits int);
CREATE TABLE guardian (first_name text, last_name text, student_id text, FOREIGN KEY(student_id) REFERENCES student(student_id));
INSERT INTO student (student_id, first_name, last_name, age) VALUES ('2018CS100', 'John', 'McEnroe', 24);
INSERT INTO teacher (first_name, last_name, subjects) VALUES ('Mary', 'Gold Smith', 'Mathematics');
INSERT INTO teacher (first_name, last_name, subjects) VALUES ('James', 'Gibberson', 'English, French, Politics');
INSERT INTO school (name, students_count, state) VALUES ('NewWorld Academy', 1255, 'Texas');
INSERT INTO course (course_id, name, credits) VALUES ('CS101', 'Computer Science', 120);
INSERT INTO guardian (first_name, last_name, student_id) VALUES ('James', 'Patterson', '2018CS100');
SELECT * FROM student;
SELECT * FROM teacher;
SELECT * FROM school;
SELECT * FROM course;
SELECT * FROM guardian;
Explanation / Answer
1. alter table student add column dob date;
This statement adds the new column to the student table.
2. alter table teacher add column experience int;
This will add experience column to the teacher table.
3. alter table school add column address varchar(20);
This will add address column to the school table
4. alter table add column course_dept varchar(10);
This will add course dept to the course table..
5 alter table guardian add column mobile int;
This will add mobile column to the guardian table
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.