BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text, Age integer , Place Text); insert into NAMES VALUES(1,'zoro',19,'ribandar'); insert into NAMES VALUES(2,'rover',19,'merces'); insert into NAMES VALUES(3,'moon',18,'siolim'); insert into NAMES VALUES(4,'raj',19,'merces'); select * from NAMES;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text, age integer, place text); insert into NAMES VALUES(1,'TOM',19,'ribandar'); insert into NAMES VALUES(2,'VISHAL',20,'mapusa'); insert into NAMES VALUES(3,'anuvi',20,'siolim'); select * from NAMES;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text, age integer, place text); insert into NAMES VALUES(1,'Rancho',2,'Siolim'); insert into NAMES VALUES(2,'Joel',20,'Panjim'); insert into NAMES VALUES(3,'Joy',20,'Panjim'); insert into NAMES VALUES(4,'jeanette',10,'Siolim'); insert into NAMES VALUES(5,'Anson',20,'Para'); Select * from NAMES;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text, age integer, place text); insert into NAMES VALUES(1,'durdana',19,'mapusa'); insert into NAMES VALUES(2,'raj',20,'merces'); select * from NAMES;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text,age integer,place text); insert into NAMES VALUES(1,'malcolm',20,'mapusa'); insert into NAMES VALUES(2,'scindia',18,'banda'); insert into NAMES VALUES(3,'aryton',20,'ponda'); insert into NAMES VALUES(4,'samiullah',20,'panaji'); insert into NAMES VALUES(5,'aquib',19,'para'); select * from NAMES;
BEGIN TRANSACTION; /* Create a table called Students */ CREATE TABLE Students(Id integer PRIMARY KEY, firstname text, lastname text, grade integer, lunch integer, favclass text); /* Create few records in this table */ INSERT INTO Students VALUES(1,'Jonathan','Gibson', 12, 1, 'Database Design'); INSERT INTO Students VALUES(2,'Antron','Rowland', 11, 3, 'Health & PE'); INSERT INTO Students VALUES(3,'Naya-Leigh','Williams', 10, 2, 'Database Design'); INSERT INTO Students VALUES(4,'Izayah','Taylor', 10, 3, 'Math'); INSERT INTO Students VALUES(5,'Jayden','Wilkins', 11, 1, 'Culinary Arts'); INSERT INTO Students VALUES(6,'To-Kobe','Norfleet', 10, 2, 'Database Design'); INSERT INTO Students VALUES(7,'Justin','Aviles', 11, 1, 'Health & PE'); INSERT INTO Students VALUES(8,'Samantha','Kemp', 11, 1, 'English'); INSERT INTO Students VALUES(9, 'Julia','Birchett', 10, 1, 'JROTC'); COMMIT; SELECT * FROM Students; BEGIN TRANSACTION; /* Create a table called Teachers */ CREATE TABLE Teachers(id integer PRIMARY KEY, suffix text, lastname text, class text, lunch integer, planning integer); /* Create a few records in this table */ INSERT INTO Teachers VALUES(1, 'Ms', 'Crocker', 'Business', 2, 4); INSERT INTO Teachers VALUES(2, '1st Sgt', 'Whitfield', 'JROTC', 1, 3); INSERT INTO Teachers VALUES(3, 'Ms', 'Johnson', 'English', 1, 4); INSERT INTO Teachers VALUES(4, 'Ms', 'Garrett', 'English', 1, 4); INSERT INTO Teachers VALUES(5, 'Ms', 'Modecki', 'Health & PE', 2, 3); INSERT INTO Teachers VALUES(6, 'Ms', 'Gibson', 'English', 1, 4); INSERT INTO Teachers VALUES(7, 'Ms', 'Ewald', 'Culinary Arts', 3, 3); INSERT INTO Teachers VALUES(8, 'Mr', 'Irby', 'Database Design', 2, 1); INSERT INTO Teachers VALUES(9, 'Col', 'Kanney', 'JROTC', 1, 3); COMMIT; SELECT * FROM Teachers;
BEGIN TRANSACTION; /* Create a table called Students */ CREATE TABLE Students(Id integer PRIMARY KEY, firstname text, lastname text, Grade integer, Lunch integer, Favclass text ); /* Create few records in this table */ INSERT INTO Students VALUES(1,'Julia', 'Birchett',10, 1, 'Colonel Kanney'); INSERT INTO Students VALUES(2,'Antron', 'Rowland', 11,3, 'Modecki'); INSERT INTO Students VALUES(3,'Justin', 'Avilez', 11,1, 'Modecki'); INSERT INTO Students VALUES(4,'Naya-Leigh', 'Williams', 10, 2,'Irby'); INSERT INTO Students VALUES(5,'Swaay', 'Taylor', 10,3, 'Irby'); INSERT INTO Students VALUES(6,'Gibby', 'Gibson',12,1, 'Irby'); INSERT INTO Students VALUES(7,'Jayden', 'Wilkins', 11,1,'Ewald'); INSERT INTO Students VALUES(8,'Samantha', 'Kemp', 11,1,'Gibson'); INSERT INTO Students VALUES(9,'To-Kobe', 'Norfleet', 10, 2, 'Irby'); COMMIT; /* Display all the records from the table */ SELECT * FROM Students; CREATE TABLE TEACHERS(Id integer PRIMARY KEY, lastname text, Lunch integer, Planning integer, class text,suffix ); /* Create few records in this table */ INSERT INTO TEACHERS VALUES(1 'COLONEL KANNEY', 3, 3, 'Jrotc'); INSERT INTO TEACHERS VALUES(2 'Modecki', 3,3, 'Gym' ); INSERT INTO TEACHERS VALUES(3 'Irby' , 2, 1, 'Programming'); INSERT INTO TEACHERS VALUES(4 'Ewald', 3,3, 'Netrition'); INSERT INTO TEACHERS VALUES(5 'Gibson', 3,4, 'English'); INSERT INTO TEACHERS VALUES(6 'Crocker', 1,2, 'Business'); INSERT INTO TEACHERS VALUES(7 '1st sgt', 3,3, 'Jrotc'); INSERT INTO TEACHERS VALUES(8 'Ms.Johnson' 4,4, 'English'); INSERT INTO TEACHERS VALUES(9 'Ms. Garrett' 3,4, 'English'): COMMIT; /* Display all the records from the table */ SELECT * FROM Students;
/* EXERCISE 3.16 */ BEGIN TRANSACTION; DROP TABLE IF EXISTS Model; DROP TABLE IF EXISTS Expert; DROP TABLE IF EXISTS Employee_tech; DROP TABLE IF EXISTS Employee_traffic; DROP TABLE IF EXISTS Employees; CREATE TABLE Model (model_no INTEGER, capacity REAL, weight REAL, PRIMARY KEY (model_no)); CREATE TABLE Expert(model_no INTEGER, ssn INTEGER, PRIMARY KEY (model_no, ssn), FOREIGN KEY (ssn) REFERENCES Employees, FOREIGN KEY (model_no) REFERENCES Model); CREATE TABLE Employee_tech (salary REAL, name CHAR(20), address CHAR(50), phone_no CHAR(13), ssn INTEGER, PRIMARY KEY (ssn), FOREIGN KEY (ssn) REFERENCES Employees ON DELETE CASCADE); CREATE TABLE Employee_traffic (exam_date DATE, ssn INTEGER, PRIMARY KEY (ssn), FOREIGN KEY (ssn) REFERENCES Employees ON DELETE CASCADE); CREATE TABLE Employees (ssn INTEGER, union_mem_no INTEGER, PRIMARY KEY (ssn)); COMMIT;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE MM(Id integer PRIMARY KEY, FRName text, Age integer); /* Create few records in this table */ INSERT INTO MM VALUES(1,'Moncy',24); INSERT INTO MM VALUES(2,'Priyanka',24); INSERT INTO MM VALUES(3,'Teju',25); INSERT INTO MM VALUES(4,'Anish',26); COMMIT; /* Display all the records from the table */ SELECT * FROM MM;
BEGIN TRANSACTION; /* Create a table called NAMES */ CREATE TABLE PARTNER(Id integer PRIMARY KEY, PartnerName text, PartnerTag text); /* Create few records in this table */ INSERT INTO PARTNER VALUES(1,'Burger King','Burger'); INSERT INTO PARTNER VALUES(2,'Dominos Pizza','Pizza'); INSERT INTO PARTNER VALUES(3,'MacDonald','Burger'); INSERT INTO PARTNER VALUES(4,'Subway','Sandwich'); INSERT INTO PARTNER VALUES(5,'Eat Sushi','Sushi'); COMMIT; /* Display all the records from the table */ SELECT COUNT(Id) AS '# PARTNER BURGER' FROM PARTNER WHERE PartnerTag=='Burger'; SELECT COUNT(Id) AS '# PARTNER BURGER', PartnerTag FROM PARTNER GROUP BY PartnerTag;
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more