How would I go about populating this database in SQLlite? Thank you for the help
ID: 3704062 • Letter: H
Question
How would I go about populating this database in SQLlite? Thank you for the help!!!
CREATE DATABASE MovieReview;
USE MovieReview;
/*Table: Movies*/
CREATE TABLE Movies(
MID integer primary key autoincrement,
Title char(128),
Gross real not null,
DateReleased date
);
/*Table: Actor*/
CREATE TABLE Actor(
AID integer primary key autoincrement,
FirstName char(50) not null,
LastName char(50) not null,
CreditedAs char(50) null
);
/*Table: User*/
CREATE TABLE User
(
Username char(20) not null unique,
Joined datetime not null
);
/*Table: Reviews*/
CREATE TABLE Reviews(
MID integer not null ,
Username char(20) not null ,
Review text not null
);
/*Table: Star*/
CREATE TABLE Star(
AID integer not null,
MID inetger not null
);
Next, add INSERT statements to your script to populate your database with the below tuples. Note that not all tables will be populated. Be sure to comment your code to indicate a separation between database/table creation statements and insert statements. AID FirstName Last Name CreditedAs Actor John Smith JensonEm Jenson EmilV MID Title Gross DateReleased Movie 1 The Wild West 6502831.03 2004-10-05 AID MID Stars1 Username movieJunkie 2001-08-02 13:45:45 Joined User Note that, except for numeric datatypes, all data should be surrounded by quotes for insertion, and the data should be typed in exactly as shown in the above table (e.g., the Joined attribute in User CS 364 Assignment 04 Page 3 of 11 should be formatted exactly as shown. Also note that there should be specific auto-generated values for some tuples/attributes, which will require ordering your insertion statements in a particular way.Explanation / Answer
Answer)
Insert Queries are below the create table statements for each table.
/*Table: Movies*/
CREATE TABLE Movies(
MID integer primary key autoincrement,
Title char(128),
Gross real not null,
DateReleased date
);
insert into Movies values(1,'The Wild West',6502831.03,2004-10-05);
/*Table: Actor*/
CREATE TABLE Actor(
AID integer primary key autoincrement,
FirstName char(50) not null,
LastName char(50) not null,
CreditedAs char(50) null
);
insert into Actor values(1,'John','Smith','');
insert into Actor values(2,'Emily','Jenson','Em Jenson');
/*Table: User*/
CREATE TABLE User
(
Username char(20) not null unique,
Joined datetime not null
);
insert into User values('movieJunkie','2001-08-02 13:45:45');
/*Table: Reviews*/
CREATE TABLE Reviews(
MID integer not null ,
Username char(20) not null ,
Review text not null
);
/*Table: Star*/
CREATE TABLE Star(
AID integer not null,
MID inetger not null
);
insert into Star values(1,1);
insert into Star values(2,1);
select * from Actor;
Output:
1|John|Smith|
2|Emily|Jenson|Em Jenson
select * from Movie;
Output:
1|The Wild West|6502831.03|1989
select * from Star;
Output:
1|1
2|1
select * from User;
Output:
movieJunkie|2001-08-02 13:45:45
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.