CREATE TABLE location ( regionID INTEGER PRIMARY KEY, region TEXT NOT NULL, country TEXT NOT NULL ); CREATE TABLE students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, gender TEXT NOT NULL, age integer NOT NULL, regionRef INTEGER NOT NULL, FOREIGN KEY(regionRef) REFERENCES location(id) ); -- insert some values INSERT INTO location VALUES (1, 'Blenheim', 'New Zealand'); INSERT INTO location VALUES (2, 'Sydney' , 'Australia'); INSERT INTO location VALUES (3, 'Lisbon' , 'Portugal'); INSERT INTO location VALUES (4, 'Madrid' , 'Spain'); INSERT INTO students VALUES (1, 'Ryan' , 'Male', 18, 1); INSERT INTO students VALUES (2, 'Joanna' , 'Female', 30, 2); INSERT INTO students VALUES (3, 'Chelsea', 'Female', 29, 4); INSERT INTO students VALUES (4, 'Ronaldo', 'Male', 36, 3); INSERT INTO students VALUES (5, 'Trish' , 'Female', 38, 2); -- Exercise 1: Display all the students? SELECT * FROM students; select * from location ; select * from students where gender ='female' or gender ='male'; select * from students where gender = 'female' ; select *from location where region = 'Lisbon' ;
To embed this project on your website, copy the following code and paste it into your website's HTML: