db_id
stringlengths 3
31
| tables
stringlengths 629
17.5k
| schema
stringlengths 334
8.29k
|
---|---|---|
debate | {"people": {"columns": [[0, "People_ID", "INT", 0, null, 1], [1, "District", "TEXT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "Party", "TEXT", 0, null, 0], [4, "Age", "INT", 0, null, 0]], "primary_keys": ["People_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "People_ID"]]], "check_constraints": []}, "debate": {"columns": [[0, "Debate_ID", "INT", 0, null, 1], [1, "Date", "TEXT", 0, null, 0], [2, "Venue", "TEXT", 0, null, 0], [3, "Num_of_Audience", "INT", 0, null, 0]], "primary_keys": ["Debate_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Debate_ID"]]], "check_constraints": []}, "debate_people": {"columns": [[0, "Debate_ID", "INT", 0, null, 1], [1, "Affirmative", "INT", 0, null, 2], [2, "Negative", "INT", 0, null, 3], [3, "If_Affirmative_Win", "bool", 0, null, 0]], "primary_keys": ["Debate_ID", "Affirmative", "Negative"], "foreign_keys": [[0, 0, "people", "Negative", "People_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "people", "Affirmative", "People_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "debate", "Debate_ID", "Debate_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Debate_ID"], [1, 1, "Affirmative"], [2, 2, "Negative"]]], "check_constraints": []}} | CREATE TABLE people (
People_ID INT PRIMARY KEY,
District TEXT,
Name TEXT,
Party TEXT,
Age INT,
UNIQUE (People_ID)
);
CREATE TABLE debate (
Debate_ID INT PRIMARY KEY,
Date TEXT,
Venue TEXT,
Num_of_Audience INT,
UNIQUE (Debate_ID)
);
CREATE TABLE debate_people (
Debate_ID INT PRIMARY KEY,
Affirmative INT PRIMARY KEY,
Negative INT PRIMARY KEY,
If_Affirmative_Win bool,
PRIMARY KEY (Debate_ID, Affirmative, Negative),
UNIQUE (Debate_ID, Affirmative, Negative),
FOREIGN KEY (Negative) REFERENCES people(People_ID),
FOREIGN KEY (Affirmative) REFERENCES people(People_ID),
FOREIGN KEY (Debate_ID) REFERENCES debate(Debate_ID)
); |
flight_2 | {"airlines": {"columns": [[0, "uid", "INTEGER", 0, null, 1], [1, "Airline", "TEXT", 0, null, 0], [2, "Abbreviation", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0]], "primary_keys": ["uid"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "airports": {"columns": [[0, "City", "TEXT", 0, null, 0], [1, "AirportCode", "TEXT", 0, null, 1], [2, "AirportName", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0], [4, "CountryAbbrev", "TEXT", 0, null, 0]], "primary_keys": ["AirportCode"], "foreign_keys": [], "unique_constraints": [[[0, 1, "AirportCode"]]], "check_constraints": []}, "flights": {"columns": [[0, "Airline", "INTEGER", 0, null, 1], [1, "FlightNo", "INTEGER", 0, null, 2], [2, "SourceAirport", "TEXT", 0, null, 0], [3, "DestAirport", "TEXT", 0, null, 0]], "primary_keys": ["Airline", "FlightNo"], "foreign_keys": [[0, 0, "airports", "DestAirport", "AirportCode", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "airports", "SourceAirport", "AirportCode", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Airline"], [1, 1, "FlightNo"]]], "check_constraints": []}} | CREATE TABLE airlines (
uid INTEGER PRIMARY KEY,
Airline TEXT,
Abbreviation TEXT,
Country TEXT
);
CREATE TABLE airports (
City TEXT,
AirportCode TEXT PRIMARY KEY,
AirportName TEXT,
Country TEXT,
CountryAbbrev TEXT,
UNIQUE (AirportCode)
);
CREATE TABLE flights (
Airline INTEGER PRIMARY KEY,
FlightNo INTEGER PRIMARY KEY,
SourceAirport TEXT,
DestAirport TEXT,
PRIMARY KEY (Airline, FlightNo),
UNIQUE (Airline, FlightNo),
FOREIGN KEY (DestAirport) REFERENCES airports(AirportCode),
FOREIGN KEY (SourceAirport) REFERENCES airports(AirportCode)
); |
school_player | {"school": {"columns": [[0, "School_ID", "INT", 0, null, 1], [1, "School", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Enrollment", "REAL", 0, null, 0], [4, "Founded", "REAL", 0, null, 0], [5, "Denomination", "TEXT", 0, null, 0], [6, "Boys_or_Girls", "TEXT", 0, null, 0], [7, "Day_or_Boarding", "TEXT", 0, null, 0], [8, "Year_Entered_Competition", "REAL", 0, null, 0], [9, "School_Colors", "TEXT", 0, null, 0]], "primary_keys": ["School_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "School_ID"]]], "check_constraints": []}, "school_details": {"columns": [[0, "School_ID", "INT", 0, null, 1], [1, "Nickname", "TEXT", 0, null, 0], [2, "Colors", "TEXT", 0, null, 0], [3, "League", "TEXT", 0, null, 0], [4, "Class", "TEXT", 0, null, 0], [5, "Division", "TEXT", 0, null, 0]], "primary_keys": ["School_ID"], "foreign_keys": [[0, 0, "school", "School_ID", "School_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "School_ID"]]], "check_constraints": []}, "school_performance": {"columns": [[0, "School_Id", "INT", 0, null, 1], [1, "School_Year", "TEXT", 0, null, 2], [2, "Class_A", "TEXT", 0, null, 0], [3, "Class_AA", "TEXT", 0, null, 0]], "primary_keys": ["School_Id", "School_Year"], "foreign_keys": [[0, 0, "school", "School_Id", "School_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "School_Id"], [1, 1, "School_Year"]]], "check_constraints": []}, "player": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "Player", "TEXT", 0, null, 0], [2, "Team", "TEXT", 0, null, 0], [3, "Age", "INT", 0, null, 0], [4, "Position", "TEXT", 0, null, 0], [5, "School_ID", "INT", 0, null, 0]], "primary_keys": ["Player_ID"], "foreign_keys": [[0, 0, "school", "School_ID", "School_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Player_ID"]]], "check_constraints": []}} | CREATE TABLE school (
School_ID INT PRIMARY KEY,
School TEXT,
Location TEXT,
Enrollment REAL,
Founded REAL,
Denomination TEXT,
Boys_or_Girls TEXT,
Day_or_Boarding TEXT,
Year_Entered_Competition REAL,
School_Colors TEXT,
UNIQUE (School_ID)
);
CREATE TABLE school_details (
School_ID INT PRIMARY KEY,
Nickname TEXT,
Colors TEXT,
League TEXT,
Class TEXT,
Division TEXT,
UNIQUE (School_ID),
FOREIGN KEY (School_ID) REFERENCES school(School_ID)
);
CREATE TABLE school_performance (
School_Id INT PRIMARY KEY,
School_Year TEXT PRIMARY KEY,
Class_A TEXT,
Class_AA TEXT,
PRIMARY KEY (School_Id, School_Year),
UNIQUE (School_Id, School_Year),
FOREIGN KEY (School_Id) REFERENCES school(School_ID)
);
CREATE TABLE player (
Player_ID INT PRIMARY KEY,
Player TEXT,
Team TEXT,
Age INT,
Position TEXT,
School_ID INT,
UNIQUE (Player_ID),
FOREIGN KEY (School_ID) REFERENCES school(School_ID)
); |
real_estate_properties | {"Ref_Feature_Types": {"columns": [[0, "feature_type_code", "VARCHAR(20)", 0, null, 1], [1, "feature_type_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["feature_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "feature_type_code"]]], "check_constraints": []}, "Ref_Property_Types": {"columns": [[0, "property_type_code", "VARCHAR(20)", 0, null, 1], [1, "property_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["property_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "property_type_code"]]], "check_constraints": []}, "Other_Available_Features": {"columns": [[0, "feature_id", "INTEGER", 0, null, 1], [1, "feature_type_code", "VARCHAR(20)", 1, null, 0], [2, "feature_name", "VARCHAR(80)", 0, null, 0], [3, "feature_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["feature_id"], "foreign_keys": [[0, 0, "Ref_Feature_Types", "feature_type_code", "feature_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Properties": {"columns": [[0, "property_id", "INTEGER", 0, null, 1], [1, "property_type_code", "VARCHAR(20)", 1, null, 0], [2, "date_on_market", "DATETIME", 0, null, 0], [3, "date_sold", "DATETIME", 0, null, 0], [4, "property_name", "VARCHAR(80)", 0, null, 0], [5, "property_address", "VARCHAR(255)", 0, null, 0], [6, "room_count", "INTEGER", 0, null, 0], [7, "vendor_requested_price", "DECIMAL(19,4)", 0, null, 0], [8, "buyer_offered_price", "DECIMAL(19,4)", 0, null, 0], [9, "agreed_selling_price", "DECIMAL(19,4)", 0, null, 0], [10, "apt_feature_1", "VARCHAR(255)", 0, null, 0], [11, "apt_feature_2", "VARCHAR(255)", 0, null, 0], [12, "apt_feature_3", "VARCHAR(255)", 0, null, 0], [13, "fld_feature_1", "VARCHAR(255)", 0, null, 0], [14, "fld_feature_2", "VARCHAR(255)", 0, null, 0], [15, "fld_feature_3", "VARCHAR(255)", 0, null, 0], [16, "hse_feature_1", "VARCHAR(255)", 0, null, 0], [17, "hse_feature_2", "VARCHAR(255)", 0, null, 0], [18, "hse_feature_3", "VARCHAR(255)", 0, null, 0], [19, "oth_feature_1", "VARCHAR(255)", 0, null, 0], [20, "oth_feature_2", "VARCHAR(255)", 0, null, 0], [21, "oth_feature_3", "VARCHAR(255)", 0, null, 0], [22, "shp_feature_1", "VARCHAR(255)", 0, null, 0], [23, "shp_feature_2", "VARCHAR(255)", 0, null, 0], [24, "shp_feature_3", "VARCHAR(255)", 0, null, 0], [25, "other_property_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["property_id"], "foreign_keys": [[0, 0, "Ref_Property_Types", "property_type_code", "property_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Other_Property_Features": {"columns": [[0, "property_id", "INTEGER", 1, null, 0], [1, "feature_id", "INTEGER", 1, null, 0], [2, "property_feature_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Properties", "property_id", "property_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Other_Available_Features", "feature_id", "feature_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Feature_Types (
feature_type_code VARCHAR(20) PRIMARY KEY,
feature_type_name VARCHAR(80),
UNIQUE (feature_type_code)
);
CREATE TABLE Ref_Property_Types (
property_type_code VARCHAR(20) PRIMARY KEY,
property_type_description VARCHAR(80),
UNIQUE (property_type_code)
);
CREATE TABLE Other_Available_Features (
feature_id INTEGER PRIMARY KEY,
feature_type_code VARCHAR(20) NOT NULL,
feature_name VARCHAR(80),
feature_description VARCHAR(80),
FOREIGN KEY (feature_type_code) REFERENCES Ref_Feature_Types(feature_type_code)
);
CREATE TABLE Properties (
property_id INTEGER PRIMARY KEY,
property_type_code VARCHAR(20) NOT NULL,
date_on_market DATETIME,
date_sold DATETIME,
property_name VARCHAR(80),
property_address VARCHAR(255),
room_count INTEGER,
vendor_requested_price DECIMAL(19,4),
buyer_offered_price DECIMAL(19,4),
agreed_selling_price DECIMAL(19,4),
apt_feature_1 VARCHAR(255),
apt_feature_2 VARCHAR(255),
apt_feature_3 VARCHAR(255),
fld_feature_1 VARCHAR(255),
fld_feature_2 VARCHAR(255),
fld_feature_3 VARCHAR(255),
hse_feature_1 VARCHAR(255),
hse_feature_2 VARCHAR(255),
hse_feature_3 VARCHAR(255),
oth_feature_1 VARCHAR(255),
oth_feature_2 VARCHAR(255),
oth_feature_3 VARCHAR(255),
shp_feature_1 VARCHAR(255),
shp_feature_2 VARCHAR(255),
shp_feature_3 VARCHAR(255),
other_property_details VARCHAR(255),
FOREIGN KEY (property_type_code) REFERENCES Ref_Property_Types(property_type_code)
);
CREATE TABLE Other_Property_Features (
property_id INTEGER NOT NULL,
feature_id INTEGER NOT NULL,
property_feature_description VARCHAR(80),
FOREIGN KEY (property_id) REFERENCES Properties(property_id),
FOREIGN KEY (feature_id) REFERENCES Other_Available_Features(feature_id)
); |
customers_and_addresses | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "address_content", "VARCHAR(80)", 0, null, 0], [2, "city", "VARCHAR(50)", 0, null, 0], [3, "zip_postcode", "VARCHAR(20)", 0, null, 0], [4, "state_province_county", "VARCHAR(50)", 0, null, 0], [5, "country", "VARCHAR(50)", 0, null, 0], [6, "other_address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "payment_method", "VARCHAR(15)", 1, null, 0], [2, "customer_name", "VARCHAR(80)", 0, null, 0], [3, "date_became_customer", "DATETIME", 0, null, 0], [4, "other_customer_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "address_id", "INTEGER", 1, null, 0], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "address_type", "VARCHAR(15)", 1, null, 0], [4, "date_address_to", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Contact_Channels": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "channel_code", "VARCHAR(15)", 1, null, 0], [2, "active_from_date", "DATETIME", 1, null, 0], [3, "active_to_date", "DATETIME", 0, null, 0], [4, "contact_number", "VARCHAR(50)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "order_status", "VARCHAR(15)", 1, null, 0], [3, "order_date", "DATETIME", 0, null, 0], [4, "order_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["order_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "order_id", "INTEGER", 1, null, 0], [1, "product_id", "INTEGER", 1, null, 0], [2, "order_quantity", "VARCHAR(15)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customer_Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
address_content VARCHAR(80),
city VARCHAR(50),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
other_address_details VARCHAR(255)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_details VARCHAR(255)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
payment_method VARCHAR(15) NOT NULL,
customer_name VARCHAR(80),
date_became_customer DATETIME,
other_customer_details VARCHAR(255)
);
CREATE TABLE Customer_Addresses (
customer_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_address_from DATETIME NOT NULL,
address_type VARCHAR(15) NOT NULL,
date_address_to DATETIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Customer_Contact_Channels (
customer_id INTEGER NOT NULL,
channel_code VARCHAR(15) NOT NULL,
active_from_date DATETIME NOT NULL,
active_to_date DATETIME,
contact_number VARCHAR(50) NOT NULL,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Customer_Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_status VARCHAR(15) NOT NULL,
order_date DATETIME,
order_details VARCHAR(255),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
order_quantity VARCHAR(15),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
); |
cre_Drama_Workshop_Groups | {"Ref_Payment_Methods": {"columns": [[0, "payment_method_code", "CHAR(10)", 1, null, 1], [1, "payment_method_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["payment_method_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "payment_method_code"]]], "check_constraints": []}, "Ref_Service_Types": {"columns": [[0, "Service_Type_Code", "CHAR(15)", 1, null, 1], [1, "Parent_Service_Type_Code", "CHAR(15)", 0, null, 0], [2, "Service_Type_Description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Service_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Service_Type_Code"]]], "check_constraints": []}, "Addresses": {"columns": [[0, "Address_ID", "VARCHAR(100)", 1, null, 1], [1, "Line_1", "VARCHAR(255)", 0, null, 0], [2, "Line_2", "VARCHAR(255)", 0, null, 0], [3, "City_Town", "VARCHAR(255)", 0, null, 0], [4, "State_County", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Address_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Address_ID"]]], "check_constraints": []}, "Products": {"columns": [[0, "Product_ID", "VARCHAR(100)", 1, null, 1], [1, "Product_Name", "VARCHAR(255)", 0, null, 0], [2, "Product_Price", "DECIMAL(20,4)", 0, null, 0], [3, "Product_Description", "VARCHAR(255)", 0, null, 0], [4, "Other_Product_Service_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Product_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Product_ID"]]], "check_constraints": []}, "Marketing_Regions": {"columns": [[0, "Marketing_Region_Code", "CHAR(15)", 1, null, 1], [1, "Marketing_Region_Name", "VARCHAR(255)", 1, null, 0], [2, "Marketing_Region_Descriptrion", "VARCHAR(255)", 1, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Marketing_Region_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Marketing_Region_Code"]]], "check_constraints": []}, "Clients": {"columns": [[0, "Client_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [3, "Customer_Name", "VARCHAR(255)", 0, null, 0], [4, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Client_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Client_ID"]]], "check_constraints": []}, "Drama_Workshop_Groups": {"columns": [[0, "Workshop_Group_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Currency_Code", "CHAR(15)", 1, null, 0], [3, "Marketing_Region_Code", "CHAR(15)", 1, null, 0], [4, "Store_Name", "VARCHAR(255)", 0, null, 0], [5, "Store_Phone", "VARCHAR(255)", 0, null, 0], [6, "Store_Email_Address", "VARCHAR(255)", 0, null, 0], [7, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Workshop_Group_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Workshop_Group_ID"]]], "check_constraints": []}, "Performers": {"columns": [[0, "Performer_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Name", "VARCHAR(255)", 0, null, 0], [3, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [4, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Performer_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Performer_ID"]]], "check_constraints": []}, "Customers": {"columns": [[0, "Customer_ID", "VARCHAR(100)", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Customer_Name", "VARCHAR(255)", 0, null, 0], [3, "Customer_Phone", "VARCHAR(255)", 0, null, 0], [4, "Customer_Email_Address", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [[0, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Customer_ID"]]], "check_constraints": []}, "Stores": {"columns": [[0, "Store_ID", "VARCHAR(100)", 1, null, 1], [1, "Address_ID", "INTEGER", 1, null, 0], [2, "Marketing_Region_Code", "CHAR(15)", 1, null, 0], [3, "Store_Name", "VARCHAR(255)", 0, null, 0], [4, "Store_Phone", "VARCHAR(255)", 0, null, 0], [5, "Store_Email_Address", "VARCHAR(255)", 0, null, 0], [6, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Store_ID"], "foreign_keys": [[0, 0, "Marketing_Regions", "Marketing_Region_Code", "Marketing_Region_Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Store_ID"]]], "check_constraints": []}, "Bookings": {"columns": [[0, "Booking_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Workshop_Group_ID", "VARCHAR(100)", 1, null, 0], [3, "Status_Code", "CHAR(15)", 1, null, 0], [4, "Store_ID", "INTEGER", 1, null, 0], [5, "Order_Date", "DATETIME", 1, null, 0], [6, "Planned_Delivery_Date", "DATETIME", 1, null, 0], [7, "Actual_Delivery_Date", "DATETIME", 1, null, 0], [8, "Other_Order_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Booking_ID"], "foreign_keys": [[0, 0, "Drama_Workshop_Groups", "Workshop_Group_ID", "Workshop_Group_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Clients", "Customer_ID", "Client_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Booking_ID"]]], "check_constraints": []}, "Performers_in_Bookings": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Performer_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Order_ID", "Performer_ID"], "foreign_keys": [[0, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Performers", "Performer_ID", "Performer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"], [1, 1, "Performer_ID"]]], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Store_ID", "INTEGER", 1, null, 0], [3, "Order_Date", "DATETIME", 1, null, 0], [4, "Planned_Delivery_Date", "DATETIME", 1, null, 0], [5, "Actual_Delivery_Date", "DATETIME", 1, null, 0], [6, "Other_Order_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Order_ID"], "foreign_keys": [[0, 0, "Stores", "Store_ID", "Store_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"]]], "check_constraints": []}, "Order_Items": {"columns": [[0, "Order_Item_ID", "INTEGER", 1, null, 1], [1, "Order_ID", "INTEGER", 1, null, 0], [2, "Product_ID", "INTEGER", 1, null, 0], [3, "Order_Quantity", "VARCHAR(288)", 0, null, 0], [4, "Other_Item_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Order_Item_ID"], "foreign_keys": [[0, 0, "Products", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customer_Orders", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Invoices": {"columns": [[0, "Invoice_ID", "INTEGER", 1, null, 1], [1, "Order_ID", "INTEGER", 1, null, 0], [2, "payment_method_code", "CHAR(15)", 0, null, 0], [3, "Product_ID", "INTEGER", 1, null, 0], [4, "Order_Quantity", "VARCHAR(288)", 0, null, 0], [5, "Other_Item_Details", "VARCHAR(255)", 0, null, 0], [6, "Order_Item_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Invoice_ID"], "foreign_keys": [[0, 0, "Ref_Payment_Methods", "payment_method_code", "payment_method_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Customer_Orders", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Services": {"columns": [[0, "Service_ID", "INTEGER", 1, null, 1], [1, "Service_Type_Code", "CHAR(15)", 0, null, 0], [2, "Workshop_Group_ID", "INTEGER", 1, null, 0], [3, "Product_Description", "VARCHAR(255)", 0, null, 0], [4, "Product_Name", "VARCHAR(255)", 0, null, 0], [5, "Product_Price", "DECIMAL(20,4)", 0, null, 0], [6, "Other_Product_Service_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Service_ID"], "foreign_keys": [[0, 0, "Ref_Service_Types", "Service_Type_Code", "Service_Type_Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Drama_Workshop_Groups", "Workshop_Group_ID", "Workshop_Group_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Service_ID"]]], "check_constraints": []}, "Bookings_Services": {"columns": [[0, "Order_ID", "INTEGER", 1, null, 1], [1, "Product_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Order_ID", "Product_ID"], "foreign_keys": [[0, 0, "Services", "Product_ID", "Service_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "Order_ID", "Booking_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Order_ID"], [1, 1, "Product_ID"]]], "check_constraints": []}, "Invoice_Items": {"columns": [[0, "Invoice_Item_ID", "INTEGER", 1, null, 1], [1, "Invoice_ID", "INTEGER", 1, null, 0], [2, "Order_ID", "INTEGER", 1, null, 0], [3, "Order_Item_ID", "INTEGER", 1, null, 0], [4, "Product_ID", "INTEGER", 1, null, 0], [5, "Order_Quantity", "INTEGER", 0, null, 0], [6, "Other_Item_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Invoice_Item_ID"], "foreign_keys": [[0, 0, "Bookings_Services", "Order_ID", "Order_ID", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Bookings_Services", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoices", "Invoice_ID", "Invoice_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Order_Items", "Order_Item_ID", "Order_Item_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Payment_Methods (
payment_method_code CHAR(10) NOT NULL PRIMARY KEY,
payment_method_description VARCHAR(80),
UNIQUE (payment_method_code)
);
CREATE TABLE Ref_Service_Types (
Service_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Parent_Service_Type_Code CHAR(15),
Service_Type_Description VARCHAR(255),
UNIQUE (Service_Type_Code)
);
CREATE TABLE Addresses (
Address_ID VARCHAR(100) NOT NULL PRIMARY KEY,
Line_1 VARCHAR(255),
Line_2 VARCHAR(255),
City_Town VARCHAR(255),
State_County VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Address_ID)
);
CREATE TABLE Products (
Product_ID VARCHAR(100) NOT NULL PRIMARY KEY,
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
Product_Description VARCHAR(255),
Other_Product_Service_Details VARCHAR(255),
UNIQUE (Product_ID)
);
CREATE TABLE Marketing_Regions (
Marketing_Region_Code CHAR(15) NOT NULL PRIMARY KEY,
Marketing_Region_Name VARCHAR(255) NOT NULL,
Marketing_Region_Descriptrion VARCHAR(255) NOT NULL,
Other_Details VARCHAR(255),
UNIQUE (Marketing_Region_Code)
);
CREATE TABLE Clients (
Client_ID INTEGER NOT NULL PRIMARY KEY,
Address_ID INTEGER NOT NULL,
Customer_Email_Address VARCHAR(255),
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Client_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);
CREATE TABLE Drama_Workshop_Groups (
Workshop_Group_ID INTEGER NOT NULL PRIMARY KEY,
Address_ID INTEGER NOT NULL,
Currency_Code CHAR(15) NOT NULL,
Marketing_Region_Code CHAR(15) NOT NULL,
Store_Name VARCHAR(255),
Store_Phone VARCHAR(255),
Store_Email_Address VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Workshop_Group_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);
CREATE TABLE Performers (
Performer_ID INTEGER NOT NULL PRIMARY KEY,
Address_ID INTEGER NOT NULL,
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Customer_Email_Address VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Performer_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);
CREATE TABLE Customers (
Customer_ID VARCHAR(100) NOT NULL PRIMARY KEY,
Address_ID INTEGER NOT NULL,
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Customer_Email_Address VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Customer_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);
CREATE TABLE Stores (
Store_ID VARCHAR(100) NOT NULL PRIMARY KEY,
Address_ID INTEGER NOT NULL,
Marketing_Region_Code CHAR(15) NOT NULL,
Store_Name VARCHAR(255),
Store_Phone VARCHAR(255),
Store_Email_Address VARCHAR(255),
Other_Details VARCHAR(255),
UNIQUE (Store_ID),
FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions(Marketing_Region_Code),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID)
);
CREATE TABLE Bookings (
Booking_ID INTEGER NOT NULL PRIMARY KEY,
Customer_ID INTEGER NOT NULL,
Workshop_Group_ID VARCHAR(100) NOT NULL,
Status_Code CHAR(15) NOT NULL,
Store_ID INTEGER NOT NULL,
Order_Date DATETIME NOT NULL,
Planned_Delivery_Date DATETIME NOT NULL,
Actual_Delivery_Date DATETIME NOT NULL,
Other_Order_Details VARCHAR(255),
UNIQUE (Booking_ID),
FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups(Workshop_Group_ID),
FOREIGN KEY (Customer_ID) REFERENCES Clients(Client_ID)
);
CREATE TABLE Performers_in_Bookings (
Order_ID INTEGER NOT NULL PRIMARY KEY,
Performer_ID INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (Order_ID, Performer_ID),
UNIQUE (Order_ID, Performer_ID),
FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID),
FOREIGN KEY (Performer_ID) REFERENCES Performers(Performer_ID)
);
CREATE TABLE Customer_Orders (
Order_ID INTEGER NOT NULL PRIMARY KEY,
Customer_ID INTEGER NOT NULL,
Store_ID INTEGER NOT NULL,
Order_Date DATETIME NOT NULL,
Planned_Delivery_Date DATETIME NOT NULL,
Actual_Delivery_Date DATETIME NOT NULL,
Other_Order_Details VARCHAR(255),
UNIQUE (Order_ID),
FOREIGN KEY (Store_ID) REFERENCES Stores(Store_ID),
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);
CREATE TABLE Order_Items (
Order_Item_ID INTEGER NOT NULL PRIMARY KEY,
Order_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
Order_Quantity VARCHAR(288),
Other_Item_Details VARCHAR(255),
FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID),
FOREIGN KEY (Order_ID) REFERENCES Customer_Orders(Order_ID)
);
CREATE TABLE Invoices (
Invoice_ID INTEGER NOT NULL PRIMARY KEY,
Order_ID INTEGER NOT NULL,
payment_method_code CHAR(15),
Product_ID INTEGER NOT NULL,
Order_Quantity VARCHAR(288),
Other_Item_Details VARCHAR(255),
Order_Item_ID INTEGER NOT NULL,
FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods(payment_method_code),
FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID),
FOREIGN KEY (Order_ID) REFERENCES Customer_Orders(Order_ID)
);
CREATE TABLE Services (
Service_ID INTEGER NOT NULL PRIMARY KEY,
Service_Type_Code CHAR(15),
Workshop_Group_ID INTEGER NOT NULL,
Product_Description VARCHAR(255),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
Other_Product_Service_Details VARCHAR(255),
UNIQUE (Service_ID),
FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types(Service_Type_Code),
FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups(Workshop_Group_ID)
);
CREATE TABLE Bookings_Services (
Order_ID INTEGER NOT NULL PRIMARY KEY,
Product_ID INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (Order_ID, Product_ID),
UNIQUE (Order_ID, Product_ID),
FOREIGN KEY (Product_ID) REFERENCES Services(Service_ID),
FOREIGN KEY (Order_ID) REFERENCES Bookings(Booking_ID)
);
CREATE TABLE Invoice_Items (
Invoice_Item_ID INTEGER NOT NULL PRIMARY KEY,
Invoice_ID INTEGER NOT NULL,
Order_ID INTEGER NOT NULL,
Order_Item_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
Order_Quantity INTEGER,
Other_Item_Details VARCHAR(255),
FOREIGN KEY (Order_ID) REFERENCES Bookings_Services(Order_ID),
FOREIGN KEY (Product_ID) REFERENCES Bookings_Services(Product_ID),
FOREIGN KEY (Invoice_ID) REFERENCES Invoices(Invoice_ID),
FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items(Order_Item_ID)
); |
store_product | {"product": {"columns": [[0, "product_id", "INT", 0, null, 1], [1, "product", "TEXT", 0, null, 0], [2, "dimensions", "TEXT", 0, null, 0], [3, "dpi", "REAL", 0, null, 0], [4, "pages_per_minute_color", "REAL", 0, null, 0], [5, "max_page_size", "TEXT", 0, null, 0], [6, "interface", "TEXT", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "product_id"]]], "check_constraints": []}, "store": {"columns": [[0, "Store_ID", "INT", 0, null, 1], [1, "Store_Name", "TEXT", 0, null, 0], [2, "Type", "TEXT", 0, null, 0], [3, "Area_size", "REAL", 0, null, 0], [4, "Number_of_product_category", "REAL", 0, null, 0], [5, "Ranking", "INT", 0, null, 0]], "primary_keys": ["Store_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Store_ID"]]], "check_constraints": []}, "district": {"columns": [[0, "District_ID", "INT", 0, null, 1], [1, "District_name", "TEXT", 0, null, 0], [2, "Headquartered_City", "TEXT", 0, null, 0], [3, "City_Population", "REAL", 0, null, 0], [4, "City_Area", "REAL", 0, null, 0]], "primary_keys": ["District_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "District_ID"]]], "check_constraints": []}, "store_product": {"columns": [[0, "Store_ID", "INT", 0, null, 1], [1, "Product_ID", "INT", 0, null, 2]], "primary_keys": ["Store_ID", "Product_ID"], "foreign_keys": [[0, 0, "product", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "store", "Store_ID", "Store_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Store_ID"], [1, 1, "Product_ID"]]], "check_constraints": []}, "store_district": {"columns": [[0, "Store_ID", "INT", 0, null, 1], [1, "District_ID", "INT", 0, null, 0]], "primary_keys": ["Store_ID"], "foreign_keys": [[0, 0, "district", "District_ID", "District_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "store", "Store_ID", "Store_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Store_ID"]]], "check_constraints": []}} | CREATE TABLE product (
product_id INT PRIMARY KEY,
product TEXT,
dimensions TEXT,
dpi REAL,
pages_per_minute_color REAL,
max_page_size TEXT,
interface TEXT,
UNIQUE (product_id)
);
CREATE TABLE store (
Store_ID INT PRIMARY KEY,
Store_Name TEXT,
Type TEXT,
Area_size REAL,
Number_of_product_category REAL,
Ranking INT,
UNIQUE (Store_ID)
);
CREATE TABLE district (
District_ID INT PRIMARY KEY,
District_name TEXT,
Headquartered_City TEXT,
City_Population REAL,
City_Area REAL,
UNIQUE (District_ID)
);
CREATE TABLE store_product (
Store_ID INT PRIMARY KEY,
Product_ID INT PRIMARY KEY,
PRIMARY KEY (Store_ID, Product_ID),
UNIQUE (Store_ID, Product_ID),
FOREIGN KEY (Product_ID) REFERENCES product(Product_ID),
FOREIGN KEY (Store_ID) REFERENCES store(Store_ID)
);
CREATE TABLE store_district (
Store_ID INT PRIMARY KEY,
District_ID INT,
UNIQUE (Store_ID),
FOREIGN KEY (District_ID) REFERENCES district(District_ID),
FOREIGN KEY (Store_ID) REFERENCES store(Store_ID)
); |
aircraft | {"pilot": {"columns": [[0, "Pilot_Id", "int(11)", 1, null, 1], [1, "Name", "varchar(50)", 1, null, 0], [2, "Age", "int(11)", 1, null, 0]], "primary_keys": ["Pilot_Id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Pilot_Id"]]], "check_constraints": []}, "aircraft": {"columns": [[0, "Aircraft_ID", "int(11)", 1, null, 1], [1, "Aircraft", "varchar(50)", 1, null, 0], [2, "Description", "varchar(50)", 1, null, 0], [3, "Max_Gross_Weight", "varchar(50)", 1, null, 0], [4, "Total_disk_area", "varchar(50)", 1, null, 0], [5, "Max_disk_Loading", "varchar(50)", 1, null, 0]], "primary_keys": ["Aircraft_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Aircraft_ID"]]], "check_constraints": []}, "match": {"columns": [[0, "Round", "REAL", 0, null, 1], [1, "Location", "TEXT", 0, null, 0], [2, "Country", "TEXT", 0, null, 0], [3, "Date", "TEXT", 0, null, 0], [4, "Fastest_Qualifying", "TEXT", 0, null, 0], [5, "Winning_Pilot", "TEXT", 0, null, 0], [6, "Winning_Aircraft", "TEXT", 0, null, 0]], "primary_keys": ["Round"], "foreign_keys": [[0, 0, "pilot", "Winning_Pilot", "Pilot_Id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "aircraft", "Winning_Aircraft", "Aircraft_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Round"]]], "check_constraints": []}, "airport": {"columns": [[0, "Airport_ID", "INT", 0, null, 1], [1, "Airport_Name", "TEXT", 0, null, 0], [2, "Total_Passengers", "REAL", 0, null, 0], [3, "%_Change_2007", "TEXT", 0, null, 0], [4, "International_Passengers", "REAL", 0, null, 0], [5, "Domestic_Passengers", "REAL", 0, null, 0], [6, "Transit_Passengers", "REAL", 0, null, 0], [7, "Aircraft_Movements", "REAL", 0, null, 0], [8, "Freight_Metric_Tonnes", "REAL", 0, null, 0]], "primary_keys": ["Airport_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Airport_ID"]]], "check_constraints": []}, "airport_aircraft": {"columns": [[0, "ID", "INT", 0, null, 0], [1, "Airport_ID", "INT", 0, null, 1], [2, "Aircraft_ID", "INT", 0, null, 2]], "primary_keys": ["Airport_ID", "Aircraft_ID"], "foreign_keys": [[0, 0, "aircraft", "Aircraft_ID", "Aircraft_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "airport", "Airport_ID", "Airport_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "Airport_ID"], [1, 2, "Aircraft_ID"]]], "check_constraints": []}} | CREATE TABLE pilot (
Pilot_Id int(11) NOT NULL PRIMARY KEY,
Name varchar(50) NOT NULL,
Age int(11) NOT NULL,
UNIQUE (Pilot_Id)
);
CREATE TABLE aircraft (
Aircraft_ID int(11) NOT NULL PRIMARY KEY,
Aircraft varchar(50) NOT NULL,
Description varchar(50) NOT NULL,
Max_Gross_Weight varchar(50) NOT NULL,
Total_disk_area varchar(50) NOT NULL,
Max_disk_Loading varchar(50) NOT NULL,
UNIQUE (Aircraft_ID)
);
CREATE TABLE match (
Round REAL PRIMARY KEY,
Location TEXT,
Country TEXT,
Date TEXT,
Fastest_Qualifying TEXT,
Winning_Pilot TEXT,
Winning_Aircraft TEXT,
UNIQUE (Round),
FOREIGN KEY (Winning_Pilot) REFERENCES pilot(Pilot_Id),
FOREIGN KEY (Winning_Aircraft) REFERENCES aircraft(Aircraft_ID)
);
CREATE TABLE airport (
Airport_ID INT PRIMARY KEY,
Airport_Name TEXT,
Total_Passengers REAL,
%_Change_2007 TEXT,
International_Passengers REAL,
Domestic_Passengers REAL,
Transit_Passengers REAL,
Aircraft_Movements REAL,
Freight_Metric_Tonnes REAL,
UNIQUE (Airport_ID)
);
CREATE TABLE airport_aircraft (
ID INT,
Airport_ID INT PRIMARY KEY,
Aircraft_ID INT PRIMARY KEY,
PRIMARY KEY (Airport_ID, Aircraft_ID),
UNIQUE (Airport_ID, Aircraft_ID),
FOREIGN KEY (Aircraft_ID) REFERENCES aircraft(Aircraft_ID),
FOREIGN KEY (Airport_ID) REFERENCES airport(Airport_ID)
); |
sports_competition | {"club": {"columns": [[0, "Club_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Region", "TEXT", 0, null, 0], [3, "Start_year", "TEXT", 0, null, 0]], "primary_keys": ["Club_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Club_ID"]]], "check_constraints": []}, "club_rank": {"columns": [[0, "Rank", "REAL", 0, null, 1], [1, "Club_ID", "INT", 0, null, 2], [2, "Gold", "REAL", 0, null, 0], [3, "Silver", "REAL", 0, null, 0], [4, "Bronze", "REAL", 0, null, 0], [5, "Total", "REAL", 0, null, 0]], "primary_keys": ["Rank", "Club_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Rank"], [1, 1, "Club_ID"]]], "check_constraints": []}, "player": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Position", "TEXT", 0, null, 0], [3, "Club_ID", "INT", 0, null, 0], [4, "Apps", "REAL", 0, null, 0], [5, "Tries", "REAL", 0, null, 0], [6, "Goals", "TEXT", 0, null, 0], [7, "Points", "REAL", 0, null, 0]], "primary_keys": ["Player_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Player_ID"]]], "check_constraints": []}, "competition": {"columns": [[0, "Competition_ID", "INT", 0, null, 1], [1, "Year", "REAL", 0, null, 0], [2, "Competition_type", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0]], "primary_keys": ["Competition_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Competition_ID"]]], "check_constraints": []}, "competition_result": {"columns": [[0, "Competition_ID", "INT", 0, null, 1], [1, "Club_ID_1", "INT", 0, null, 2], [2, "Club_ID_2", "INT", 0, null, 3], [3, "Score", "TEXT", 0, null, 0]], "primary_keys": ["Competition_ID", "Club_ID_1", "Club_ID_2"], "foreign_keys": [[0, 0, "competition", "Competition_ID", "Competition_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "club", "Club_ID_2", "Club_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "club", "Club_ID_1", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Competition_ID"], [1, 1, "Club_ID_1"], [2, 2, "Club_ID_2"]]], "check_constraints": []}} | CREATE TABLE club (
Club_ID INT PRIMARY KEY,
name TEXT,
Region TEXT,
Start_year TEXT,
UNIQUE (Club_ID)
);
CREATE TABLE club_rank (
Rank REAL PRIMARY KEY,
Club_ID INT PRIMARY KEY,
Gold REAL,
Silver REAL,
Bronze REAL,
Total REAL,
PRIMARY KEY (Rank, Club_ID),
UNIQUE (Rank, Club_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
);
CREATE TABLE player (
Player_ID INT PRIMARY KEY,
name TEXT,
Position TEXT,
Club_ID INT,
Apps REAL,
Tries REAL,
Goals TEXT,
Points REAL,
UNIQUE (Player_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
);
CREATE TABLE competition (
Competition_ID INT PRIMARY KEY,
Year REAL,
Competition_type TEXT,
Country TEXT,
UNIQUE (Competition_ID)
);
CREATE TABLE competition_result (
Competition_ID INT PRIMARY KEY,
Club_ID_1 INT PRIMARY KEY,
Club_ID_2 INT PRIMARY KEY,
Score TEXT,
PRIMARY KEY (Competition_ID, Club_ID_1, Club_ID_2),
UNIQUE (Competition_ID, Club_ID_1, Club_ID_2),
FOREIGN KEY (Competition_ID) REFERENCES competition(Competition_ID),
FOREIGN KEY (Club_ID_2) REFERENCES club(Club_ID),
FOREIGN KEY (Club_ID_1) REFERENCES club(Club_ID)
); |
restaurants | {"GEOGRAPHIC": {"columns": [[0, "CITY_NAME", "TEXT", 0, null, 1], [1, "COUNTY", "TEXT", 0, null, 0], [2, "REGION", "TEXT", 0, null, 0]], "primary_keys": ["CITY_NAME"], "foreign_keys": [], "unique_constraints": [[[0, 0, "CITY_NAME"]]], "check_constraints": []}, "RESTAURANT": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "NAME", "TEXT", 0, null, 0], [2, "FOOD_TYPE", "TEXT", 0, null, 0], [3, "CITY_NAME", "TEXT", 0, null, 0], [4, "RATING", "REAL", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [[0, 0, "GEOGRAPHIC", "CITY_NAME", "CITY_NAME", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "LOCATION": {"columns": [[0, "RESTAURANT_ID", "INT", 0, null, 1], [1, "HOUSE_NUMBER", "INT", 0, null, 0], [2, "STREET_NAME", "TEXT", 0, null, 0], [3, "CITY_NAME", "TEXT", 0, null, 0]], "primary_keys": ["RESTAURANT_ID"], "foreign_keys": [[0, 0, "RESTAURANT", "RESTAURANT_ID", "RESTAURANT_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "GEOGRAPHIC", "CITY_NAME", "CITY_NAME", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "RESTAURANT_ID"]]], "check_constraints": []}} | CREATE TABLE GEOGRAPHIC (
CITY_NAME TEXT PRIMARY KEY,
COUNTY TEXT,
REGION TEXT,
UNIQUE (CITY_NAME)
);
CREATE TABLE RESTAURANT (
ID INT PRIMARY KEY,
NAME TEXT,
FOOD_TYPE TEXT,
CITY_NAME TEXT,
RATING REAL,
UNIQUE (ID),
FOREIGN KEY (CITY_NAME) REFERENCES GEOGRAPHIC(CITY_NAME)
);
CREATE TABLE LOCATION (
RESTAURANT_ID INT PRIMARY KEY,
HOUSE_NUMBER INT,
STREET_NAME TEXT,
CITY_NAME TEXT,
UNIQUE (RESTAURANT_ID),
FOREIGN KEY (RESTAURANT_ID) REFERENCES RESTAURANT(RESTAURANT_ID),
FOREIGN KEY (CITY_NAME) REFERENCES GEOGRAPHIC(CITY_NAME)
); |
insurance_and_eClaims | {"Customers": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Customer_Details", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Staff": {"columns": [[0, "Staff_ID", "INTEGER", 1, null, 1], [1, "Staff_Details", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Staff_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Policies": {"columns": [[0, "Policy_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Policy_Type_Code", "CHAR(15)", 1, null, 0], [3, "Start_Date", "DATETIME", 0, null, 0], [4, "End_Date", "DATETIME", 0, null, 0]], "primary_keys": ["Policy_ID"], "foreign_keys": [[0, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Claim_Headers": {"columns": [[0, "Claim_Header_ID", "INTEGER", 1, null, 1], [1, "Claim_Status_Code", "CHAR(15)", 1, null, 0], [2, "Claim_Type_Code", "CHAR(15)", 1, null, 0], [3, "Policy_ID", "INTEGER", 1, null, 0], [4, "Date_of_Claim", "DATETIME", 0, null, 0], [5, "Date_of_Settlement", "DATETIME", 0, null, 0], [6, "Amount_Claimed", "DECIMAL(20,4)", 0, null, 0], [7, "Amount_Piad", "DECIMAL(20,4)", 0, null, 0]], "primary_keys": ["Claim_Header_ID"], "foreign_keys": [[0, 0, "Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Claims_Documents": {"columns": [[0, "Claim_ID", "INTEGER", 1, null, 1], [1, "Document_Type_Code", "CHAR(15)", 1, null, 2], [2, "Created_by_Staff_ID", "INTEGER", 0, null, 0], [3, "Created_Date", "INTEGER", 0, null, 0]], "primary_keys": ["Claim_ID", "Document_Type_Code"], "foreign_keys": [[0, 0, "Staff", "Created_by_Staff_ID", "Staff_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Claim_Headers", "Claim_ID", "Claim_Header_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Claim_ID"], [1, 1, "Document_Type_Code"]]], "check_constraints": []}, "Claims_Processing_Stages": {"columns": [[0, "Claim_Stage_ID", "INTEGER", 1, null, 1], [1, "Next_Claim_Stage_ID", "INTEGER", 0, null, 0], [2, "Claim_Status_Name", "VARCHAR(255)", 1, null, 0], [3, "Claim_Status_Description", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Claim_Stage_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Claims_Processing": {"columns": [[0, "Claim_Processing_ID", "INTEGER", 1, null, 1], [1, "Claim_ID", "INTEGER", 1, null, 0], [2, "Claim_Outcome_Code", "CHAR(15)", 1, null, 0], [3, "Claim_Stage_ID", "INTEGER", 1, null, 0], [4, "Staff_ID", "INTEGER", 0, null, 0]], "primary_keys": ["Claim_Processing_ID"], "foreign_keys": [[0, 0, "Staff", "Staff_ID", "Staff_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Claim_Headers", "Claim_ID", "Claim_Header_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Customers (
Customer_ID INTEGER NOT NULL PRIMARY KEY,
Customer_Details VARCHAR(255) NOT NULL
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL PRIMARY KEY,
Staff_Details VARCHAR(255) NOT NULL
);
CREATE TABLE Policies (
Policy_ID INTEGER NOT NULL PRIMARY KEY,
Customer_ID INTEGER NOT NULL,
Policy_Type_Code CHAR(15) NOT NULL,
Start_Date DATETIME,
End_Date DATETIME,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);
CREATE TABLE Claim_Headers (
Claim_Header_ID INTEGER NOT NULL PRIMARY KEY,
Claim_Status_Code CHAR(15) NOT NULL,
Claim_Type_Code CHAR(15) NOT NULL,
Policy_ID INTEGER NOT NULL,
Date_of_Claim DATETIME,
Date_of_Settlement DATETIME,
Amount_Claimed DECIMAL(20,4),
Amount_Piad DECIMAL(20,4),
FOREIGN KEY (Policy_ID) REFERENCES Policies(Policy_ID)
);
CREATE TABLE Claims_Documents (
Claim_ID INTEGER NOT NULL PRIMARY KEY,
Document_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Created_by_Staff_ID INTEGER,
Created_Date INTEGER,
PRIMARY KEY (Claim_ID, Document_Type_Code),
UNIQUE (Claim_ID, Document_Type_Code),
FOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff(Staff_ID),
FOREIGN KEY (Claim_ID) REFERENCES Claim_Headers(Claim_Header_ID)
);
CREATE TABLE Claims_Processing_Stages (
Claim_Stage_ID INTEGER NOT NULL PRIMARY KEY,
Next_Claim_Stage_ID INTEGER,
Claim_Status_Name VARCHAR(255) NOT NULL,
Claim_Status_Description VARCHAR(255) NOT NULL
);
CREATE TABLE Claims_Processing (
Claim_Processing_ID INTEGER NOT NULL PRIMARY KEY,
Claim_ID INTEGER NOT NULL,
Claim_Outcome_Code CHAR(15) NOT NULL,
Claim_Stage_ID INTEGER NOT NULL,
Staff_ID INTEGER,
FOREIGN KEY (Staff_ID) REFERENCES Staff(Staff_ID),
FOREIGN KEY (Claim_ID) REFERENCES Claim_Headers(Claim_Header_ID)
); |
twitter_1 | {"follows": {"columns": [[0, "f1", "int(11)", 1, null, 1], [1, "f2", "int(11)", 1, null, 2]], "primary_keys": ["f1", "f2"], "foreign_keys": [[0, 0, "user_profiles", "f2", "uid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "user_profiles", "f1", "uid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "f1"], [1, 1, "f2"]]], "check_constraints": []}, "tweets": {"columns": [[0, "id", "bigint(20)", 1, null, 1], [1, "uid", "int(11)", 1, null, 0], [2, "text", "char(140)", 1, null, 0], [3, "createdate", "datetime", 0, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "user_profiles", "uid", "uid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "user_profiles": {"columns": [[0, "uid", "int(11)", 1, null, 1], [1, "name", "varchar(255)", 0, "NULL", 0], [2, "email", "varchar(255)", 0, "NULL", 0], [3, "partitionid", "int(11)", 0, "NULL", 0], [4, "followers", "int(11)", 0, "NULL", 0]], "primary_keys": ["uid"], "foreign_keys": [], "unique_constraints": [[[0, 0, "uid"]]], "check_constraints": []}} | CREATE TABLE follows (
f1 int(11) NOT NULL PRIMARY KEY,
f2 int(11) NOT NULL PRIMARY KEY,
PRIMARY KEY (f1, f2),
UNIQUE (f1, f2),
FOREIGN KEY (f2) REFERENCES user_profiles(uid),
FOREIGN KEY (f1) REFERENCES user_profiles(uid)
);
CREATE TABLE tweets (
id bigint(20) NOT NULL PRIMARY KEY,
uid int(11) NOT NULL,
text char(140) NOT NULL,
createdate datetime DEFAULT CURRENT_TIMESTAMP,
UNIQUE (id),
FOREIGN KEY (uid) REFERENCES user_profiles(uid)
);
CREATE TABLE user_profiles (
uid int(11) NOT NULL PRIMARY KEY,
name varchar(255) DEFAULT NULL,
email varchar(255) DEFAULT NULL,
partitionid int(11) DEFAULT NULL,
followers int(11) DEFAULT NULL,
UNIQUE (uid)
); |
riding_club | {"player": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "Sponsor_name", "TEXT", 0, null, 0], [2, "Player_name", "TEXT", 0, null, 0], [3, "Gender", "TEXT", 0, null, 0], [4, "Residence", "TEXT", 0, null, 0], [5, "Occupation", "TEXT", 0, null, 0], [6, "Votes", "INT", 0, null, 0], [7, "Rank", "TEXT", 0, null, 0]], "primary_keys": ["Player_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Player_ID"]]], "check_constraints": []}, "club": {"columns": [[0, "Club_ID", "INT", 0, null, 1], [1, "Club_name", "TEXT", 0, null, 0], [2, "Region", "TEXT", 0, null, 0], [3, "Start_year", "INT", 0, null, 0]], "primary_keys": ["Club_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Club_ID"]]], "check_constraints": []}, "coach": {"columns": [[0, "Coach_ID", "INT", 0, null, 1], [1, "Coach_name", "TEXT", 0, null, 0], [2, "Gender", "TEXT", 0, null, 0], [3, "Club_ID", "INT", 0, null, 0], [4, "Rank", "INT", 0, null, 0]], "primary_keys": ["Coach_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Coach_ID"]]], "check_constraints": []}, "player_coach": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "Coach_ID", "INT", 0, null, 2], [2, "Starting_year", "INT", 0, null, 0]], "primary_keys": ["Player_ID", "Coach_ID"], "foreign_keys": [[0, 0, "coach", "Coach_ID", "Coach_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "player", "Player_ID", "Player_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Player_ID"], [1, 1, "Coach_ID"]]], "check_constraints": []}, "match_result": {"columns": [[0, "Rank", "INT", 0, null, 1], [1, "Club_ID", "INT", 0, null, 2], [2, "Gold", "INT", 0, null, 0], [3, "Big_Silver", "INT", 0, null, 0], [4, "Small_Silver", "INT", 0, null, 0], [5, "Bronze", "INT", 0, null, 0], [6, "Points", "INT", 0, null, 0]], "primary_keys": ["Rank", "Club_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Rank"], [1, 1, "Club_ID"]]], "check_constraints": []}} | CREATE TABLE player (
Player_ID INT PRIMARY KEY,
Sponsor_name TEXT,
Player_name TEXT,
Gender TEXT,
Residence TEXT,
Occupation TEXT,
Votes INT,
Rank TEXT,
UNIQUE (Player_ID)
);
CREATE TABLE club (
Club_ID INT PRIMARY KEY,
Club_name TEXT,
Region TEXT,
Start_year INT,
UNIQUE (Club_ID)
);
CREATE TABLE coach (
Coach_ID INT PRIMARY KEY,
Coach_name TEXT,
Gender TEXT,
Club_ID INT,
Rank INT,
UNIQUE (Coach_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
);
CREATE TABLE player_coach (
Player_ID INT PRIMARY KEY,
Coach_ID INT PRIMARY KEY,
Starting_year INT,
PRIMARY KEY (Player_ID, Coach_ID),
UNIQUE (Player_ID, Coach_ID),
FOREIGN KEY (Coach_ID) REFERENCES coach(Coach_ID),
FOREIGN KEY (Player_ID) REFERENCES player(Player_ID)
);
CREATE TABLE match_result (
Rank INT PRIMARY KEY,
Club_ID INT PRIMARY KEY,
Gold INT,
Big_Silver INT,
Small_Silver INT,
Bronze INT,
Points INT,
PRIMARY KEY (Rank, Club_ID),
UNIQUE (Rank, Club_ID),
FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
); |
insurance_fnol | {"Customers": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Customer_name", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Services": {"columns": [[0, "Service_ID", "INTEGER", 1, null, 1], [1, "Service_name", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["Service_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Available_Policies": {"columns": [[0, "Policy_ID", "INTEGER", 1, null, 1], [1, "policy_type_code", "CHAR(15)", 0, null, 0], [2, "Customer_Phone", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Policy_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Policy_ID"]]], "check_constraints": []}, "Customers_Policies": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Policy_ID", "INTEGER", 1, null, 2], [2, "Date_Opened", "DATE", 0, null, 0], [3, "Date_Closed", "DATE", 0, null, 0]], "primary_keys": ["Customer_ID", "Policy_ID"], "foreign_keys": [[0, 0, "Available_Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Customer_ID"], [1, 1, "Policy_ID"]]], "check_constraints": []}, "First_Notification_of_Loss": {"columns": [[0, "FNOL_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Policy_ID", "INTEGER", 1, null, 0], [3, "Service_ID", "INTEGER", 1, null, 0]], "primary_keys": ["FNOL_ID"], "foreign_keys": [[0, 0, "Customers_Policies", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Customers_Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Services", "Service_ID", "Service_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "FNOL_ID"]]], "check_constraints": []}, "Claims": {"columns": [[0, "Claim_ID", "INTEGER", 1, null, 1], [1, "FNOL_ID", "INTEGER", 1, null, 0], [2, "Effective_Date", "DATE", 0, null, 0]], "primary_keys": ["Claim_ID"], "foreign_keys": [[0, 0, "First_Notification_of_Loss", "FNOL_ID", "FNOL_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Claim_ID"]]], "check_constraints": []}, "Settlements": {"columns": [[0, "Settlement_ID", "INTEGER", 1, null, 1], [1, "Claim_ID", "INTEGER", 0, null, 0], [2, "Effective_Date", "DATE", 0, null, 0], [3, "Settlement_Amount", "REAL", 0, null, 0]], "primary_keys": ["Settlement_ID"], "foreign_keys": [[0, 0, "Claims", "Claim_ID", "Claim_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Settlement_ID"]]], "check_constraints": []}} | CREATE TABLE Customers (
Customer_ID INTEGER NOT NULL PRIMARY KEY,
Customer_name VARCHAR(40)
);
CREATE TABLE Services (
Service_ID INTEGER NOT NULL PRIMARY KEY,
Service_name VARCHAR(40)
);
CREATE TABLE Available_Policies (
Policy_ID INTEGER NOT NULL PRIMARY KEY,
policy_type_code CHAR(15),
Customer_Phone VARCHAR(255),
UNIQUE (Policy_ID)
);
CREATE TABLE Customers_Policies (
Customer_ID INTEGER NOT NULL PRIMARY KEY,
Policy_ID INTEGER NOT NULL PRIMARY KEY,
Date_Opened DATE,
Date_Closed DATE,
PRIMARY KEY (Customer_ID, Policy_ID),
UNIQUE (Customer_ID, Policy_ID),
FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);
CREATE TABLE First_Notification_of_Loss (
FNOL_ID INTEGER NOT NULL PRIMARY KEY,
Customer_ID INTEGER NOT NULL,
Policy_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
UNIQUE (FNOL_ID),
FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),
FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),
FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);
CREATE TABLE Claims (
Claim_ID INTEGER NOT NULL PRIMARY KEY,
FNOL_ID INTEGER NOT NULL,
Effective_Date DATE,
UNIQUE (Claim_ID),
FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)
);
CREATE TABLE Settlements (
Settlement_ID INTEGER NOT NULL PRIMARY KEY,
Claim_ID INTEGER,
Effective_Date DATE,
Settlement_Amount REAL,
UNIQUE (Settlement_ID),
FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)
); |
company_1 | {"works_on": {"columns": [[0, "Essn", "INTEGER", 0, null, 1], [1, "Pno", "INTEGER", 0, null, 2], [2, "Hours", "REAL", 0, null, 0]], "primary_keys": ["Essn", "Pno"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Essn"], [1, 1, "Pno"]]], "check_constraints": []}, "employee": {"columns": [[0, "Fname", "TEXT", 0, null, 0], [1, "Minit", "TEXT", 0, null, 0], [2, "Lname", "TEXT", 0, null, 0], [3, "Ssn", "INTEGER", 0, null, 1], [4, "Bdate", "TEXT", 0, null, 0], [5, "Address", "TEXT", 0, null, 0], [6, "Sex", "TEXT", 0, null, 0], [7, "Salary", "INTEGER", 0, null, 0], [8, "Super_ssn", "INTEGER", 0, null, 0], [9, "Dno", "INTEGER", 0, null, 0]], "primary_keys": ["Ssn"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "department": {"columns": [[0, "Dname", "TEXT", 0, null, 0], [1, "Dnumber", "INTEGER", 0, null, 1], [2, "Mgr_ssn", "INTEGER", 0, null, 0], [3, "Mgr_start_date", "TEXT", 0, null, 0]], "primary_keys": ["Dnumber"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "project": {"columns": [[0, "Pname", "TEXT", 0, null, 0], [1, "Pnumber", "INTEGER", 0, null, 1], [2, "Plocation", "TEXT", 0, null, 0], [3, "Dnum", "INTEGER", 0, null, 0]], "primary_keys": ["Pnumber"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "dependent": {"columns": [[0, "Essn", "INTEGER", 0, null, 1], [1, "Dependent_name", "TEXT", 0, null, 2], [2, "Sex", "TEXT", 0, null, 0], [3, "Bdate", "TEXT", 0, null, 0], [4, "Relationship", "TEXT", 0, null, 0]], "primary_keys": ["Essn", "Dependent_name"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Essn"], [1, 1, "Dependent_name"]]], "check_constraints": []}, "dept_locations": {"columns": [[0, "Dnumber", "INTEGER", 0, null, 1], [1, "Dlocation", "TEXT", 0, null, 2]], "primary_keys": ["Dnumber", "Dlocation"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Dnumber"], [1, 1, "Dlocation"]]], "check_constraints": []}} | CREATE TABLE works_on (
Essn INTEGER PRIMARY KEY,
Pno INTEGER PRIMARY KEY,
Hours REAL,
PRIMARY KEY (Essn, Pno),
UNIQUE (Essn, Pno)
);
CREATE TABLE employee (
Fname TEXT,
Minit TEXT,
Lname TEXT,
Ssn INTEGER PRIMARY KEY,
Bdate TEXT,
Address TEXT,
Sex TEXT,
Salary INTEGER,
Super_ssn INTEGER,
Dno INTEGER
);
CREATE TABLE department (
Dname TEXT,
Dnumber INTEGER PRIMARY KEY,
Mgr_ssn INTEGER,
Mgr_start_date TEXT
);
CREATE TABLE project (
Pname TEXT,
Pnumber INTEGER PRIMARY KEY,
Plocation TEXT,
Dnum INTEGER
);
CREATE TABLE dependent (
Essn INTEGER PRIMARY KEY,
Dependent_name TEXT PRIMARY KEY,
Sex TEXT,
Bdate TEXT,
Relationship TEXT,
PRIMARY KEY (Essn, Dependent_name),
UNIQUE (Essn, Dependent_name)
);
CREATE TABLE dept_locations (
Dnumber INTEGER PRIMARY KEY,
Dlocation TEXT PRIMARY KEY,
PRIMARY KEY (Dnumber, Dlocation),
UNIQUE (Dnumber, Dlocation)
); |
solvency_ii | {"Addresses": {"columns": [[0, "Address_ID", "INTEGER", 1, null, 1], [1, "address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Address_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Address_ID"]]], "check_constraints": []}, "Locations": {"columns": [[0, "Location_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Location_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "Product_ID", "INTEGER", 1, null, 1], [1, "Product_Type_Code", "CHAR(15)", 0, null, 0], [2, "Product_Name", "VARCHAR(255)", 0, null, 0], [3, "Product_Price", "DECIMAL(20,4)", 0, null, 0]], "primary_keys": ["Product_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Product_ID"]]], "check_constraints": []}, "Parties": {"columns": [[0, "Party_ID", "INTEGER", 1, null, 1], [1, "Party_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Party_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Assets": {"columns": [[0, "Asset_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Asset_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Channels": {"columns": [[0, "Channel_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Channel_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Finances": {"columns": [[0, "Finance_ID", "INTEGER", 1, null, 1], [1, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Finance_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Events": {"columns": [[0, "Event_ID", "INTEGER", 1, null, 1], [1, "Address_ID", "INTEGER", 0, null, 0], [2, "Channel_ID", "INTEGER", 1, null, 0], [3, "Event_Type_Code", "CHAR(15)", 0, null, 0], [4, "Finance_ID", "INTEGER", 1, null, 0], [5, "Location_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Event_ID"], "foreign_keys": [[0, 0, "Finances", "Finance_ID", "Finance_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "Address_ID", "Address_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Locations", "Location_ID", "Location_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Event_ID"]]], "check_constraints": []}, "Products_in_Events": {"columns": [[0, "Product_in_Event_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 0], [2, "Product_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Product_in_Event_ID"], "foreign_keys": [[0, 0, "Products", "Product_ID", "Product_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Parties_in_Events": {"columns": [[0, "Party_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 2], [2, "Role_Code", "CHAR(15)", 0, null, 0]], "primary_keys": ["Party_ID", "Event_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Parties", "Party_ID", "Party_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Party_ID"], [1, 1, "Event_ID"]]], "check_constraints": []}, "Agreements": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Assets_in_Events": {"columns": [[0, "Asset_ID", "INTEGER", 1, null, 1], [1, "Event_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Asset_ID", "Event_ID"], "foreign_keys": [[0, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Events", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Asset_ID"], [1, 1, "Event_ID"]]], "check_constraints": []}} | CREATE TABLE Addresses (
Address_ID INTEGER NOT NULL PRIMARY KEY,
address_details VARCHAR(255),
UNIQUE (Address_ID)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL PRIMARY KEY,
Other_Details VARCHAR(255)
);
CREATE TABLE Products (
Product_ID INTEGER NOT NULL PRIMARY KEY,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
UNIQUE (Product_ID)
);
CREATE TABLE Parties (
Party_ID INTEGER NOT NULL PRIMARY KEY,
Party_Details VARCHAR(255)
);
CREATE TABLE Assets (
Asset_ID INTEGER NOT NULL PRIMARY KEY,
Other_Details VARCHAR(255)
);
CREATE TABLE Channels (
Channel_ID INTEGER NOT NULL PRIMARY KEY,
Other_Details VARCHAR(255)
);
CREATE TABLE Finances (
Finance_ID INTEGER NOT NULL PRIMARY KEY,
Other_Details VARCHAR(255)
);
CREATE TABLE Events (
Event_ID INTEGER NOT NULL PRIMARY KEY,
Address_ID INTEGER,
Channel_ID INTEGER NOT NULL,
Event_Type_Code CHAR(15),
Finance_ID INTEGER NOT NULL,
Location_ID INTEGER NOT NULL,
UNIQUE (Event_ID),
FOREIGN KEY (Finance_ID) REFERENCES Finances(Finance_ID),
FOREIGN KEY (Address_ID) REFERENCES Addresses(Address_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations(Location_ID)
);
CREATE TABLE Products_in_Events (
Product_in_Event_ID INTEGER NOT NULL PRIMARY KEY,
Event_ID INTEGER NOT NULL,
Product_ID INTEGER NOT NULL,
FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID),
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
);
CREATE TABLE Parties_in_Events (
Party_ID INTEGER NOT NULL PRIMARY KEY,
Event_ID INTEGER NOT NULL PRIMARY KEY,
Role_Code CHAR(15),
PRIMARY KEY (Party_ID, Event_ID),
UNIQUE (Party_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
FOREIGN KEY (Party_ID) REFERENCES Parties(Party_ID)
);
CREATE TABLE Agreements (
Document_ID INTEGER NOT NULL PRIMARY KEY,
Event_ID INTEGER NOT NULL,
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
);
CREATE TABLE Assets_in_Events (
Asset_ID INTEGER NOT NULL PRIMARY KEY,
Event_ID INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (Asset_ID, Event_ID),
UNIQUE (Asset_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID)
); |
scholar | {"venue": {"columns": [[0, "venueId", "INTEGER", 1, null, 1], [1, "venueName", "varchar(100)", 0, "NULL", 0]], "primary_keys": ["venueId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "author": {"columns": [[0, "authorId", "INTEGER", 1, null, 1], [1, "authorName", "varchar(50)", 0, "NULL", 0]], "primary_keys": ["authorId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "dataset": {"columns": [[0, "datasetId", "INTEGER", 1, null, 1], [1, "datasetName", "varchar(50)", 0, "NULL", 0]], "primary_keys": ["datasetId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "journal": {"columns": [[0, "journalId", "INTEGER", 1, null, 1], [1, "journalName", "varchar(100)", 0, "NULL", 0]], "primary_keys": ["journalId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "keyphrase": {"columns": [[0, "keyphraseId", "INTEGER", 1, null, 1], [1, "keyphraseName", "varchar(50)", 0, "NULL", 0]], "primary_keys": ["keyphraseId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "paper": {"columns": [[0, "paperId", "INTEGER", 1, null, 1], [1, "title", "varchar(300)", 0, "NULL", 0], [2, "venueId", "INTEGER", 0, "NULL", 0], [3, "year", "INTEGER", 0, "NULL", 0], [4, "numCiting", "INTEGER", 0, "NULL", 0], [5, "numCitedBy", "INTEGER", 0, "NULL", 0], [6, "journalId", "INTEGER", 0, "NULL", 0]], "primary_keys": ["paperId"], "foreign_keys": [[0, 0, "venue", "venueId", "venueId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "journal", "journalId", "journalId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "cite": {"columns": [[0, "citingPaperId", "INTEGER", 1, null, 1], [1, "citedPaperId", "INTEGER", 1, null, 2]], "primary_keys": ["citingPaperId", "citedPaperId"], "foreign_keys": [[0, 0, "paper", "citingPaperId", "paperId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "paper", "citedPaperId", "paperId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "citingPaperId"], [1, 1, "citedPaperId"]]], "check_constraints": []}, "paperDataset": {"columns": [[0, "paperId", "INTEGER", 0, "NULL", 2], [1, "datasetId", "INTEGER", 0, "NULL", 1]], "primary_keys": ["paperId", "datasetId"], "foreign_keys": [], "unique_constraints": [[[0, 1, "datasetId"], [1, 0, "paperId"]]], "check_constraints": []}, "paperKeyphrase": {"columns": [[0, "paperId", "INTEGER", 0, "NULL", 2], [1, "keyphraseId", "INTEGER", 0, "NULL", 1]], "primary_keys": ["paperId", "keyphraseId"], "foreign_keys": [[0, 0, "keyphrase", "keyphraseId", "keyphraseId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "paper", "paperId", "paperId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "keyphraseId"], [1, 0, "paperId"]]], "check_constraints": []}, "writes": {"columns": [[0, "paperId", "INTEGER", 0, "NULL", 1], [1, "authorId", "INTEGER", 0, "NULL", 2]], "primary_keys": ["paperId", "authorId"], "foreign_keys": [[0, 0, "author", "authorId", "authorId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "paper", "paperId", "paperId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "paperId"], [1, 1, "authorId"]]], "check_constraints": []}} | CREATE TABLE venue (
venueId INTEGER NOT NULL PRIMARY KEY,
venueName varchar(100) DEFAULT NULL
);
CREATE TABLE author (
authorId INTEGER NOT NULL PRIMARY KEY,
authorName varchar(50) DEFAULT NULL
);
CREATE TABLE dataset (
datasetId INTEGER NOT NULL PRIMARY KEY,
datasetName varchar(50) DEFAULT NULL
);
CREATE TABLE journal (
journalId INTEGER NOT NULL PRIMARY KEY,
journalName varchar(100) DEFAULT NULL
);
CREATE TABLE keyphrase (
keyphraseId INTEGER NOT NULL PRIMARY KEY,
keyphraseName varchar(50) DEFAULT NULL
);
CREATE TABLE paper (
paperId INTEGER NOT NULL PRIMARY KEY,
title varchar(300) DEFAULT NULL,
venueId INTEGER DEFAULT NULL,
year INTEGER DEFAULT NULL,
numCiting INTEGER DEFAULT NULL,
numCitedBy INTEGER DEFAULT NULL,
journalId INTEGER DEFAULT NULL,
FOREIGN KEY (venueId) REFERENCES venue(venueId),
FOREIGN KEY (journalId) REFERENCES journal(journalId)
);
CREATE TABLE cite (
citingPaperId INTEGER NOT NULL PRIMARY KEY,
citedPaperId INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (citingPaperId, citedPaperId),
UNIQUE (citingPaperId, citedPaperId),
FOREIGN KEY (citingPaperId) REFERENCES paper(paperId),
FOREIGN KEY (citedPaperId) REFERENCES paper(paperId)
);
CREATE TABLE paperDataset (
paperId INTEGER DEFAULT NULL PRIMARY KEY,
datasetId INTEGER DEFAULT NULL PRIMARY KEY,
PRIMARY KEY (paperId, datasetId),
UNIQUE (datasetId, paperId)
);
CREATE TABLE paperKeyphrase (
paperId INTEGER DEFAULT NULL PRIMARY KEY,
keyphraseId INTEGER DEFAULT NULL PRIMARY KEY,
PRIMARY KEY (paperId, keyphraseId),
UNIQUE (keyphraseId, paperId),
FOREIGN KEY (keyphraseId) REFERENCES keyphrase(keyphraseId),
FOREIGN KEY (paperId) REFERENCES paper(paperId)
);
CREATE TABLE writes (
paperId INTEGER DEFAULT NULL PRIMARY KEY,
authorId INTEGER DEFAULT NULL PRIMARY KEY,
PRIMARY KEY (paperId, authorId),
UNIQUE (paperId, authorId),
FOREIGN KEY (authorId) REFERENCES author(authorId),
FOREIGN KEY (paperId) REFERENCES paper(paperId)
); |
customer_deliveries | {"Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_name", "VARCHAR(20)", 0, null, 0], [2, "product_price", "DECIMAL(19,4)", 0, null, 0], [3, "product_description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "address_details", "VARCHAR(80)", 0, null, 0], [2, "city", "VARCHAR(50)", 0, null, 0], [3, "zip_postcode", "VARCHAR(20)", 0, null, 0], [4, "state_province_county", "VARCHAR(50)", 0, null, 0], [5, "country", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "payment_method", "VARCHAR(10)", 1, null, 0], [2, "customer_name", "VARCHAR(80)", 0, null, 0], [3, "customer_phone", "VARCHAR(80)", 0, null, 0], [4, "customer_email", "VARCHAR(80)", 0, null, 0], [5, "date_became_customer", "DATETIME", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Regular_Orders": {"columns": [[0, "regular_order_id", "INTEGER", 0, null, 1], [1, "distributer_id", "INTEGER", 1, null, 0]], "primary_keys": ["regular_order_id"], "foreign_keys": [[0, 0, "Customers", "distributer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Regular_Order_Products": {"columns": [[0, "regular_order_id", "INTEGER", 1, null, 0], [1, "product_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Regular_Orders", "regular_order_id", "regular_order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Actual_Orders": {"columns": [[0, "actual_order_id", "INTEGER", 0, null, 1], [1, "order_status_code", "VARCHAR(10)", 1, null, 0], [2, "regular_order_id", "INTEGER", 1, null, 0], [3, "actual_order_date", "DATETIME", 0, null, 0]], "primary_keys": ["actual_order_id"], "foreign_keys": [[0, 0, "Regular_Orders", "regular_order_id", "regular_order_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Actual_Order_Products": {"columns": [[0, "actual_order_id", "INTEGER", 1, null, 0], [1, "product_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Actual_Orders", "actual_order_id", "actual_order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "address_id", "INTEGER", 1, null, 0], [2, "date_from", "DATETIME", 1, null, 0], [3, "address_type", "VARCHAR(10)", 1, null, 0], [4, "date_to", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Delivery_Routes": {"columns": [[0, "route_id", "INTEGER", 0, null, 1], [1, "route_name", "VARCHAR(50)", 0, null, 0], [2, "other_route_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["route_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Delivery_Route_Locations": {"columns": [[0, "location_code", "VARCHAR(10)", 0, null, 1], [1, "route_id", "INTEGER", 1, null, 0], [2, "location_address_id", "INTEGER", 1, null, 0], [3, "location_name", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["location_code"], "foreign_keys": [[0, 0, "Delivery_Routes", "route_id", "route_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "location_address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "location_code"]]], "check_constraints": []}, "Trucks": {"columns": [[0, "truck_id", "INTEGER", 0, null, 1], [1, "truck_licence_number", "VARCHAR(20)", 0, null, 0], [2, "truck_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["truck_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Employees": {"columns": [[0, "employee_id", "INTEGER", 0, null, 1], [1, "employee_address_id", "INTEGER", 1, null, 0], [2, "employee_name", "VARCHAR(80)", 0, null, 0], [3, "employee_phone", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["employee_id"], "foreign_keys": [[0, 0, "Addresses", "employee_address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Deliveries": {"columns": [[0, "location_code", "VARCHAR(10)", 1, null, 0], [1, "actual_order_id", "INTEGER", 1, null, 0], [2, "delivery_status_code", "VARCHAR(10)", 1, null, 0], [3, "driver_employee_id", "INTEGER", 1, null, 0], [4, "truck_id", "INTEGER", 1, null, 0], [5, "delivery_date", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Employees", "driver_employee_id", "employee_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Delivery_Route_Locations", "location_code", "location_code", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Actual_Orders", "actual_order_id", "actual_order_id", "NO ACTION", "NO ACTION", "NONE"], [3, 0, "Trucks", "truck_id", "truck_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_name VARCHAR(20),
product_price DECIMAL(19,4),
product_description VARCHAR(255)
);
CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
address_details VARCHAR(80),
city VARCHAR(50),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
payment_method VARCHAR(10) NOT NULL,
customer_name VARCHAR(80),
customer_phone VARCHAR(80),
customer_email VARCHAR(80),
date_became_customer DATETIME
);
CREATE TABLE Regular_Orders (
regular_order_id INTEGER PRIMARY KEY,
distributer_id INTEGER NOT NULL,
FOREIGN KEY (distributer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Regular_Order_Products (
regular_order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
FOREIGN KEY (regular_order_id) REFERENCES Regular_Orders(regular_order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Actual_Orders (
actual_order_id INTEGER PRIMARY KEY,
order_status_code VARCHAR(10) NOT NULL,
regular_order_id INTEGER NOT NULL,
actual_order_date DATETIME,
FOREIGN KEY (regular_order_id) REFERENCES Regular_Orders(regular_order_id)
);
CREATE TABLE Actual_Order_Products (
actual_order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
FOREIGN KEY (actual_order_id) REFERENCES Actual_Orders(actual_order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Customer_Addresses (
customer_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME NOT NULL,
address_type VARCHAR(10) NOT NULL,
date_to DATETIME,
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Delivery_Routes (
route_id INTEGER PRIMARY KEY,
route_name VARCHAR(50),
other_route_details VARCHAR(255)
);
CREATE TABLE Delivery_Route_Locations (
location_code VARCHAR(10) PRIMARY KEY,
route_id INTEGER NOT NULL,
location_address_id INTEGER NOT NULL,
location_name VARCHAR(50),
UNIQUE (location_code),
FOREIGN KEY (route_id) REFERENCES Delivery_Routes(route_id),
FOREIGN KEY (location_address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Trucks (
truck_id INTEGER PRIMARY KEY,
truck_licence_number VARCHAR(20),
truck_details VARCHAR(255)
);
CREATE TABLE Employees (
employee_id INTEGER PRIMARY KEY,
employee_address_id INTEGER NOT NULL,
employee_name VARCHAR(80),
employee_phone VARCHAR(80),
FOREIGN KEY (employee_address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Order_Deliveries (
location_code VARCHAR(10) NOT NULL,
actual_order_id INTEGER NOT NULL,
delivery_status_code VARCHAR(10) NOT NULL,
driver_employee_id INTEGER NOT NULL,
truck_id INTEGER NOT NULL,
delivery_date DATETIME,
FOREIGN KEY (driver_employee_id) REFERENCES Employees(employee_id),
FOREIGN KEY (location_code) REFERENCES Delivery_Route_Locations(location_code),
FOREIGN KEY (actual_order_id) REFERENCES Actual_Orders(actual_order_id),
FOREIGN KEY (truck_id) REFERENCES Trucks(truck_id)
); |
shop_membership | {"member": {"columns": [[0, "Member_ID", "INT", 0, null, 1], [1, "Card_Number", "TEXT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "Hometown", "TEXT", 0, null, 0], [4, "Level", "INT", 0, null, 0]], "primary_keys": ["Member_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Member_ID"]]], "check_constraints": []}, "branch": {"columns": [[0, "Branch_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Open_year", "TEXT", 0, null, 0], [3, "Address_road", "TEXT", 0, null, 0], [4, "City", "TEXT", 0, null, 0], [5, "membership_amount", "TEXT", 0, null, 0]], "primary_keys": ["Branch_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Branch_ID"]]], "check_constraints": []}, "membership_register_branch": {"columns": [[0, "Member_ID", "INT", 0, null, 1], [1, "Branch_ID", "TEXT", 0, null, 0], [2, "Register_Year", "TEXT", 0, null, 0]], "primary_keys": ["Member_ID"], "foreign_keys": [[0, 0, "branch", "Branch_ID", "Branch_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "member", "Member_ID", "Member_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Member_ID"]]], "check_constraints": []}, "purchase": {"columns": [[0, "Member_ID", "INT", 0, null, 1], [1, "Branch_ID", "TEXT", 0, null, 2], [2, "Year", "TEXT", 0, null, 3], [3, "Total_pounds", "REAL", 0, null, 0]], "primary_keys": ["Member_ID", "Branch_ID", "Year"], "foreign_keys": [[0, 0, "branch", "Branch_ID", "Branch_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "member", "Member_ID", "Member_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Member_ID"], [1, 1, "Branch_ID"], [2, 2, "Year"]]], "check_constraints": []}} | CREATE TABLE member (
Member_ID INT PRIMARY KEY,
Card_Number TEXT,
Name TEXT,
Hometown TEXT,
Level INT,
UNIQUE (Member_ID)
);
CREATE TABLE branch (
Branch_ID INT PRIMARY KEY,
Name TEXT,
Open_year TEXT,
Address_road TEXT,
City TEXT,
membership_amount TEXT,
UNIQUE (Branch_ID)
);
CREATE TABLE membership_register_branch (
Member_ID INT PRIMARY KEY,
Branch_ID TEXT,
Register_Year TEXT,
UNIQUE (Member_ID),
FOREIGN KEY (Branch_ID) REFERENCES branch(Branch_ID),
FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)
);
CREATE TABLE purchase (
Member_ID INT PRIMARY KEY,
Branch_ID TEXT PRIMARY KEY,
Year TEXT PRIMARY KEY,
Total_pounds REAL,
PRIMARY KEY (Member_ID, Branch_ID, Year),
UNIQUE (Member_ID, Branch_ID, Year),
FOREIGN KEY (Branch_ID) REFERENCES branch(Branch_ID),
FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)
); |
phone_market | {"phone": {"columns": [[0, "Name", "TEXT", 0, null, 0], [1, "Phone_ID", "INT", 0, null, 1], [2, "Memory_in_G", "INT", 0, null, 0], [3, "Carrier", "TEXT", 0, null, 0], [4, "Price", "REAL", 0, null, 0]], "primary_keys": ["Phone_ID"], "foreign_keys": [], "unique_constraints": [[[0, 1, "Phone_ID"]]], "check_constraints": []}, "market": {"columns": [[0, "Market_ID", "INT", 0, null, 1], [1, "District", "TEXT", 0, null, 0], [2, "Num_of_employees", "INT", 0, null, 0], [3, "Num_of_shops", "REAL", 0, null, 0], [4, "Ranking", "INT", 0, null, 0]], "primary_keys": ["Market_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Market_ID"]]], "check_constraints": []}, "phone_market": {"columns": [[0, "Market_ID", "INT", 0, null, 1], [1, "Phone_ID", "TEXT", 0, null, 2], [2, "Num_of_stock", "INT", 0, null, 0]], "primary_keys": ["Market_ID", "Phone_ID"], "foreign_keys": [[0, 0, "phone", "Phone_ID", "Phone_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "market", "Market_ID", "Market_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Market_ID"], [1, 1, "Phone_ID"]]], "check_constraints": []}} | CREATE TABLE phone (
Name TEXT,
Phone_ID INT PRIMARY KEY,
Memory_in_G INT,
Carrier TEXT,
Price REAL,
UNIQUE (Phone_ID)
);
CREATE TABLE market (
Market_ID INT PRIMARY KEY,
District TEXT,
Num_of_employees INT,
Num_of_shops REAL,
Ranking INT,
UNIQUE (Market_ID)
);
CREATE TABLE phone_market (
Market_ID INT PRIMARY KEY,
Phone_ID TEXT PRIMARY KEY,
Num_of_stock INT,
PRIMARY KEY (Market_ID, Phone_ID),
UNIQUE (Market_ID, Phone_ID),
FOREIGN KEY (Phone_ID) REFERENCES phone(Phone_ID),
FOREIGN KEY (Market_ID) REFERENCES market(Market_ID)
); |
network_2 | {"Person": {"columns": [[0, "name", "varchar(20)", 0, null, 1], [1, "age", "INTEGER", 0, null, 0], [2, "city", "TEXT", 0, null, 0], [3, "gender", "TEXT", 0, null, 0], [4, "job", "TEXT", 0, null, 0]], "primary_keys": ["name"], "foreign_keys": [], "unique_constraints": [[[0, 0, "name"]]], "check_constraints": []}, "PersonFriend": {"columns": [[0, "name", "varchar(20)", 0, null, 0], [1, "friend", "varchar(20)", 0, null, 0], [2, "year", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Person", "friend", "name", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Person", "name", "name", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Person (
name varchar(20) PRIMARY KEY,
age INTEGER,
city TEXT,
gender TEXT,
job TEXT,
UNIQUE (name)
);
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER,
FOREIGN KEY (friend) REFERENCES Person(name),
FOREIGN KEY (name) REFERENCES Person(name)
); |
store_1 | {"artists": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "name", "VARCHAR(120)", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "sqlite_sequence": {"columns": [[0, "name", "", 0, null, 0], [1, "seq", "", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "albums": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "title", "VARCHAR(160)", 1, null, 0], [2, "artist_id", "INTEGER", 1, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "artists", "artist_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "employees": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "last_name", "VARCHAR(20)", 1, null, 0], [2, "first_name", "VARCHAR(20)", 1, null, 0], [3, "title", "VARCHAR(30)", 0, null, 0], [4, "reports_to", "INTEGER", 0, null, 0], [5, "birth_date", "TIMESTAMP", 0, null, 0], [6, "hire_date", "TIMESTAMP", 0, null, 0], [7, "address", "VARCHAR(70)", 0, null, 0], [8, "city", "VARCHAR(40)", 0, null, 0], [9, "state", "VARCHAR(40)", 0, null, 0], [10, "country", "VARCHAR(40)", 0, null, 0], [11, "postal_code", "VARCHAR(10)", 0, null, 0], [12, "phone", "VARCHAR(24)", 0, null, 0], [13, "fax", "VARCHAR(24)", 0, null, 0], [14, "email", "VARCHAR(60)", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "employees", "reports_to", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "customers": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "first_name", "VARCHAR(40)", 1, null, 0], [2, "last_name", "VARCHAR(20)", 1, null, 0], [3, "company", "VARCHAR(80)", 0, null, 0], [4, "address", "VARCHAR(70)", 0, null, 0], [5, "city", "VARCHAR(40)", 0, null, 0], [6, "state", "VARCHAR(40)", 0, null, 0], [7, "country", "VARCHAR(40)", 0, null, 0], [8, "postal_code", "VARCHAR(10)", 0, null, 0], [9, "phone", "VARCHAR(24)", 0, null, 0], [10, "fax", "VARCHAR(24)", 0, null, 0], [11, "email", "VARCHAR(60)", 1, null, 0], [12, "support_rep_id", "INTEGER", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "employees", "support_rep_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "genres": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "name", "VARCHAR(120)", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "invoices": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "invoice_date", "TIMESTAMP", 1, null, 0], [3, "billing_address", "VARCHAR(70)", 0, null, 0], [4, "billing_city", "VARCHAR(40)", 0, null, 0], [5, "billing_state", "VARCHAR(40)", 0, null, 0], [6, "billing_country", "VARCHAR(40)", 0, null, 0], [7, "billing_postal_code", "VARCHAR(10)", 0, null, 0], [8, "total", "NUMERIC(10,2)", 1, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "customers", "customer_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "media_types": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "name", "VARCHAR(120)", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "tracks": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "name", "VARCHAR(200)", 1, null, 0], [2, "album_id", "INTEGER", 0, null, 0], [3, "media_type_id", "INTEGER", 1, null, 0], [4, "genre_id", "INTEGER", 0, null, 0], [5, "composer", "VARCHAR(220)", 0, null, 0], [6, "milliseconds", "INTEGER", 1, null, 0], [7, "bytes", "INTEGER", 0, null, 0], [8, "unit_price", "NUMERIC(10,2)", 1, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "media_types", "media_type_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "genres", "genre_id", "id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "albums", "album_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "invoice_lines": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "invoice_id", "INTEGER", 1, null, 0], [2, "track_id", "INTEGER", 1, null, 0], [3, "unit_price", "NUMERIC(10,2)", 1, null, 0], [4, "quantity", "INTEGER", 1, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "tracks", "track_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "invoices", "invoice_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "playlists": {"columns": [[0, "id", "INTEGER", 0, null, 1], [1, "name", "VARCHAR(120)", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "playlist_tracks": {"columns": [[0, "playlist_id", "INTEGER", 1, null, 1], [1, "track_id", "INTEGER", 1, null, 2]], "primary_keys": ["playlist_id", "track_id"], "foreign_keys": [[0, 0, "tracks", "track_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "playlists", "playlist_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "playlist_id"], [1, 1, "track_id"]], [[0, 0, "playlist_id"], [1, 1, "track_id"]]], "check_constraints": []}} | CREATE TABLE artists (
id INTEGER PRIMARY KEY,
name VARCHAR(120),
UNIQUE (id)
);
CREATE TABLE sqlite_sequence (
name,
seq
);
CREATE TABLE albums (
id INTEGER PRIMARY KEY,
title VARCHAR(160) NOT NULL,
artist_id INTEGER NOT NULL,
UNIQUE (id),
FOREIGN KEY (artist_id) REFERENCES artists(id)
);
CREATE TABLE employees (
id INTEGER PRIMARY KEY,
last_name VARCHAR(20) NOT NULL,
first_name VARCHAR(20) NOT NULL,
title VARCHAR(30),
reports_to INTEGER,
birth_date TIMESTAMP,
hire_date TIMESTAMP,
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60),
UNIQUE (id),
FOREIGN KEY (reports_to) REFERENCES employees(id)
);
CREATE TABLE customers (
id INTEGER PRIMARY KEY,
first_name VARCHAR(40) NOT NULL,
last_name VARCHAR(20) NOT NULL,
company VARCHAR(80),
address VARCHAR(70),
city VARCHAR(40),
state VARCHAR(40),
country VARCHAR(40),
postal_code VARCHAR(10),
phone VARCHAR(24),
fax VARCHAR(24),
email VARCHAR(60) NOT NULL,
support_rep_id INTEGER,
UNIQUE (id),
FOREIGN KEY (support_rep_id) REFERENCES employees(id)
);
CREATE TABLE genres (
id INTEGER PRIMARY KEY,
name VARCHAR(120),
UNIQUE (id)
);
CREATE TABLE invoices (
id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
invoice_date TIMESTAMP NOT NULL,
billing_address VARCHAR(70),
billing_city VARCHAR(40),
billing_state VARCHAR(40),
billing_country VARCHAR(40),
billing_postal_code VARCHAR(10),
total NUMERIC(10,2) NOT NULL,
UNIQUE (id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
CREATE TABLE media_types (
id INTEGER PRIMARY KEY,
name VARCHAR(120),
UNIQUE (id)
);
CREATE TABLE tracks (
id INTEGER PRIMARY KEY,
name VARCHAR(200) NOT NULL,
album_id INTEGER,
media_type_id INTEGER NOT NULL,
genre_id INTEGER,
composer VARCHAR(220),
milliseconds INTEGER NOT NULL,
bytes INTEGER,
unit_price NUMERIC(10,2) NOT NULL,
UNIQUE (id),
FOREIGN KEY (media_type_id) REFERENCES media_types(id),
FOREIGN KEY (genre_id) REFERENCES genres(id),
FOREIGN KEY (album_id) REFERENCES albums(id)
);
CREATE TABLE invoice_lines (
id INTEGER PRIMARY KEY,
invoice_id INTEGER NOT NULL,
track_id INTEGER NOT NULL,
unit_price NUMERIC(10,2) NOT NULL,
quantity INTEGER NOT NULL,
UNIQUE (id),
FOREIGN KEY (track_id) REFERENCES tracks(id),
FOREIGN KEY (invoice_id) REFERENCES invoices(id)
);
CREATE TABLE playlists (
id INTEGER PRIMARY KEY,
name VARCHAR(120),
UNIQUE (id)
);
CREATE TABLE playlist_tracks (
playlist_id INTEGER NOT NULL PRIMARY KEY,
track_id INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (playlist_id, track_id),
UNIQUE (playlist_id, track_id),
UNIQUE (playlist_id, track_id),
FOREIGN KEY (track_id) REFERENCES tracks(id),
FOREIGN KEY (playlist_id) REFERENCES playlists(id)
); |
product_catalog | {"Attribute_Definitions": {"columns": [[0, "attribute_id", "INTEGER", 0, null, 1], [1, "attribute_name", "VARCHAR(30)", 0, null, 0], [2, "attribute_data_type", "VARCHAR(10)", 0, null, 0]], "primary_keys": ["attribute_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Catalogs": {"columns": [[0, "catalog_id", "INTEGER", 0, null, 1], [1, "catalog_name", "VARCHAR(50)", 0, null, 0], [2, "catalog_publisher", "VARCHAR(80)", 0, null, 0], [3, "date_of_publication", "DATETIME", 0, null, 0], [4, "date_of_latest_revision", "DATETIME", 0, null, 0]], "primary_keys": ["catalog_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Catalog_Structure": {"columns": [[0, "catalog_level_number", "INTEGER", 0, null, 1], [1, "catalog_id", "INTEGER", 1, null, 0], [2, "catalog_level_name", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["catalog_level_number"], "foreign_keys": [[0, 0, "Catalogs", "catalog_id", "catalog_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Catalog_Contents": {"columns": [[0, "catalog_entry_id", "INTEGER", 0, null, 1], [1, "catalog_level_number", "INTEGER", 1, null, 0], [2, "parent_entry_id", "INTEGER", 0, null, 0], [3, "previous_entry_id", "INTEGER", 0, null, 0], [4, "next_entry_id", "INTEGER", 0, null, 0], [5, "catalog_entry_name", "VARCHAR(80)", 0, null, 0], [6, "product_stock_number", "VARCHAR(50)", 0, null, 0], [7, "price_in_dollars", "DOUBLE", 0, null, 0], [8, "price_in_euros", "DOUBLE", 0, null, 0], [9, "price_in_pounds", "DOUBLE", 0, null, 0], [10, "capacity", "VARCHAR(20)", 0, null, 0], [11, "length", "VARCHAR(20)", 0, null, 0], [12, "height", "VARCHAR(20)", 0, null, 0], [13, "width", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["catalog_entry_id"], "foreign_keys": [[0, 0, "Catalog_Structure", "catalog_level_number", "catalog_level_number", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Catalog_Contents_Additional_Attributes": {"columns": [[0, "catalog_entry_id", "INTEGER", 1, null, 0], [1, "catalog_level_number", "INTEGER", 1, null, 0], [2, "attribute_id", "INTEGER", 1, null, 0], [3, "attribute_value", "VARCHAR(255)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Catalog_Structure", "catalog_level_number", "catalog_level_number", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Catalog_Contents", "catalog_entry_id", "catalog_entry_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Attribute_Definitions (
attribute_id INTEGER PRIMARY KEY,
attribute_name VARCHAR(30),
attribute_data_type VARCHAR(10)
);
CREATE TABLE Catalogs (
catalog_id INTEGER PRIMARY KEY,
catalog_name VARCHAR(50),
catalog_publisher VARCHAR(80),
date_of_publication DATETIME,
date_of_latest_revision DATETIME
);
CREATE TABLE Catalog_Structure (
catalog_level_number INTEGER PRIMARY KEY,
catalog_id INTEGER NOT NULL,
catalog_level_name VARCHAR(50),
FOREIGN KEY (catalog_id) REFERENCES Catalogs(catalog_id)
);
CREATE TABLE Catalog_Contents (
catalog_entry_id INTEGER PRIMARY KEY,
catalog_level_number INTEGER NOT NULL,
parent_entry_id INTEGER,
previous_entry_id INTEGER,
next_entry_id INTEGER,
catalog_entry_name VARCHAR(80),
product_stock_number VARCHAR(50),
price_in_dollars DOUBLE,
price_in_euros DOUBLE,
price_in_pounds DOUBLE,
capacity VARCHAR(20),
length VARCHAR(20),
height VARCHAR(20),
width VARCHAR(20),
FOREIGN KEY (catalog_level_number) REFERENCES Catalog_Structure(catalog_level_number)
);
CREATE TABLE Catalog_Contents_Additional_Attributes (
catalog_entry_id INTEGER NOT NULL,
catalog_level_number INTEGER NOT NULL,
attribute_id INTEGER NOT NULL,
attribute_value VARCHAR(255) NOT NULL,
FOREIGN KEY (catalog_level_number) REFERENCES Catalog_Structure(catalog_level_number),
FOREIGN KEY (catalog_entry_id) REFERENCES Catalog_Contents(catalog_entry_id)
); |
insurance_policies | {"Customers": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Customer_Details", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Policies": {"columns": [[0, "Policy_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Policy_Type_Code", "CHAR(15)", 1, null, 0], [3, "Start_Date", "DATE", 0, null, 0], [4, "End_Date", "DATE", 0, null, 0]], "primary_keys": ["Policy_ID"], "foreign_keys": [[0, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Claims": {"columns": [[0, "Claim_ID", "INTEGER", 1, null, 1], [1, "Policy_ID", "INTEGER", 1, null, 0], [2, "Date_Claim_Made", "DATE", 0, null, 0], [3, "Date_Claim_Settled", "DATE", 0, null, 0], [4, "Amount_Claimed", "INTEGER", 0, null, 0], [5, "Amount_Settled", "INTEGER", 0, null, 0]], "primary_keys": ["Claim_ID"], "foreign_keys": [[0, 0, "Customer_Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Settlements": {"columns": [[0, "Settlement_ID", "INTEGER", 1, null, 1], [1, "Claim_ID", "INTEGER", 1, null, 0], [2, "Date_Claim_Made", "DATE", 0, null, 0], [3, "Date_Claim_Settled", "DATE", 0, null, 0], [4, "Amount_Claimed", "INTEGER", 0, null, 0], [5, "Amount_Settled", "INTEGER", 0, null, 0], [6, "Customer_Policy_ID", "INTEGER", 1, null, 0]], "primary_keys": ["Settlement_ID"], "foreign_keys": [[0, 0, "Claims", "Claim_ID", "Claim_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Payments": {"columns": [[0, "Payment_ID", "INTEGER", 1, null, 1], [1, "Settlement_ID", "INTEGER", 1, null, 0], [2, "Payment_Method_Code", "VARCHAR(255)", 0, null, 0], [3, "Date_Payment_Made", "DATE", 0, null, 0], [4, "Amount_Payment", "INTEGER", 0, null, 0]], "primary_keys": ["Payment_ID"], "foreign_keys": [[0, 0, "Settlements", "Settlement_ID", "Settlement_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Customers (
Customer_ID INTEGER NOT NULL PRIMARY KEY,
Customer_Details VARCHAR(255) NOT NULL
);
CREATE TABLE Customer_Policies (
Policy_ID INTEGER NOT NULL PRIMARY KEY,
Customer_ID INTEGER NOT NULL,
Policy_Type_Code CHAR(15) NOT NULL,
Start_Date DATE,
End_Date DATE,
FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);
CREATE TABLE Claims (
Claim_ID INTEGER NOT NULL PRIMARY KEY,
Policy_ID INTEGER NOT NULL,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,
Amount_Settled INTEGER,
FOREIGN KEY (Policy_ID) REFERENCES Customer_Policies(Policy_ID)
);
CREATE TABLE Settlements (
Settlement_ID INTEGER NOT NULL PRIMARY KEY,
Claim_ID INTEGER NOT NULL,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,
Amount_Settled INTEGER,
Customer_Policy_ID INTEGER NOT NULL,
FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)
);
CREATE TABLE Payments (
Payment_ID INTEGER NOT NULL PRIMARY KEY,
Settlement_ID INTEGER NOT NULL,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER,
FOREIGN KEY (Settlement_ID) REFERENCES Settlements(Settlement_ID)
); |
tracking_share_transactions | {"Investors": {"columns": [[0, "investor_id", "INTEGER", 0, null, 1], [1, "Investor_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["investor_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Lots": {"columns": [[0, "lot_id", "INTEGER", 0, null, 1], [1, "investor_id", "INTEGER", 1, null, 0], [2, "lot_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["lot_id"], "foreign_keys": [[0, 0, "Investors", "investor_id", "investor_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Ref_Transaction_Types": {"columns": [[0, "transaction_type_code", "VARCHAR(10)", 0, null, 1], [1, "transaction_type_description", "VARCHAR(80)", 1, null, 0]], "primary_keys": ["transaction_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "transaction_type_code"]]], "check_constraints": []}, "Transactions": {"columns": [[0, "transaction_id", "INTEGER", 0, null, 1], [1, "investor_id", "INTEGER", 1, null, 0], [2, "transaction_type_code", "VARCHAR(10)", 1, null, 0], [3, "date_of_transaction", "DATETIME", 0, null, 0], [4, "amount_of_transaction", "DECIMAL(19,4)", 0, null, 0], [5, "share_count", "VARCHAR(40)", 0, null, 0], [6, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["transaction_id"], "foreign_keys": [[0, 0, "Ref_Transaction_Types", "transaction_type_code", "transaction_type_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Investors", "investor_id", "investor_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Sales": {"columns": [[0, "sales_transaction_id", "INTEGER", 0, null, 1], [1, "sales_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["sales_transaction_id"], "foreign_keys": [[0, 0, "Transactions", "sales_transaction_id", "transaction_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Purchases": {"columns": [[0, "purchase_transaction_id", "INTEGER", 1, null, 0], [1, "purchase_details", "VARCHAR(255)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Transactions", "purchase_transaction_id", "transaction_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Transactions_Lots": {"columns": [[0, "transaction_id", "INTEGER", 1, null, 0], [1, "lot_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Transactions", "transaction_id", "transaction_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Lots", "lot_id", "lot_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Investors (
investor_id INTEGER PRIMARY KEY,
Investor_details VARCHAR(255)
);
CREATE TABLE Lots (
lot_id INTEGER PRIMARY KEY,
investor_id INTEGER NOT NULL,
lot_details VARCHAR(255),
FOREIGN KEY (investor_id) REFERENCES Investors(investor_id)
);
CREATE TABLE Ref_Transaction_Types (
transaction_type_code VARCHAR(10) PRIMARY KEY,
transaction_type_description VARCHAR(80) NOT NULL,
UNIQUE (transaction_type_code)
);
CREATE TABLE Transactions (
transaction_id INTEGER PRIMARY KEY,
investor_id INTEGER NOT NULL,
transaction_type_code VARCHAR(10) NOT NULL,
date_of_transaction DATETIME,
amount_of_transaction DECIMAL(19,4),
share_count VARCHAR(40),
other_details VARCHAR(255),
FOREIGN KEY (transaction_type_code) REFERENCES Ref_Transaction_Types(transaction_type_code),
FOREIGN KEY (investor_id) REFERENCES Investors(investor_id)
);
CREATE TABLE Sales (
sales_transaction_id INTEGER PRIMARY KEY,
sales_details VARCHAR(255),
FOREIGN KEY (sales_transaction_id) REFERENCES Transactions(transaction_id)
);
CREATE TABLE Purchases (
purchase_transaction_id INTEGER NOT NULL,
purchase_details VARCHAR(255) NOT NULL,
FOREIGN KEY (purchase_transaction_id) REFERENCES Transactions(transaction_id)
);
CREATE TABLE Transactions_Lots (
transaction_id INTEGER NOT NULL,
lot_id INTEGER NOT NULL,
FOREIGN KEY (transaction_id) REFERENCES Transactions(transaction_id),
FOREIGN KEY (lot_id) REFERENCES Lots(lot_id)
); |
device | {"device": {"columns": [[0, "Device_ID", "INT", 0, null, 1], [1, "Device", "TEXT", 0, null, 0], [2, "Carrier", "TEXT", 0, null, 0], [3, "Package_Version", "TEXT", 0, null, 0], [4, "Applications", "TEXT", 0, null, 0], [5, "Software_Platform", "TEXT", 0, null, 0]], "primary_keys": ["Device_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Device_ID"]]], "check_constraints": []}, "shop": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Shop_Name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Open_Date", "TEXT", 0, null, 0], [4, "Open_Year", "INT", 0, null, 0]], "primary_keys": ["Shop_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Shop_ID"]]], "check_constraints": []}, "stock": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Device_ID", "INT", 0, null, 2], [2, "Quantity", "INT", 0, null, 0]], "primary_keys": ["Shop_ID", "Device_ID"], "foreign_keys": [[0, 0, "device", "Device_ID", "Device_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "shop", "Shop_ID", "Shop_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Shop_ID"], [1, 1, "Device_ID"]]], "check_constraints": []}} | CREATE TABLE device (
Device_ID INT PRIMARY KEY,
Device TEXT,
Carrier TEXT,
Package_Version TEXT,
Applications TEXT,
Software_Platform TEXT,
UNIQUE (Device_ID)
);
CREATE TABLE shop (
Shop_ID INT PRIMARY KEY,
Shop_Name TEXT,
Location TEXT,
Open_Date TEXT,
Open_Year INT,
UNIQUE (Shop_ID)
);
CREATE TABLE stock (
Shop_ID INT PRIMARY KEY,
Device_ID INT PRIMARY KEY,
Quantity INT,
PRIMARY KEY (Shop_ID, Device_ID),
UNIQUE (Shop_ID, Device_ID),
FOREIGN KEY (Device_ID) REFERENCES device(Device_ID),
FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)
); |
customers_and_invoices | {"Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "customer_first_name", "VARCHAR(50)", 0, null, 0], [2, "customer_middle_initial", "VARCHAR(1)", 0, null, 0], [3, "customer_last_name", "VARCHAR(50)", 0, null, 0], [4, "gender", "VARCHAR(1)", 0, null, 0], [5, "email_address", "VARCHAR(255)", 0, null, 0], [6, "login_name", "VARCHAR(80)", 0, null, 0], [7, "login_password", "VARCHAR(20)", 0, null, 0], [8, "phone_number", "VARCHAR(255)", 0, null, 0], [9, "town_city", "VARCHAR(50)", 0, null, 0], [10, "state_county_province", "VARCHAR(50)", 0, null, 0], [11, "country", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "date_order_placed", "DATETIME", 1, null, 0], [3, "order_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["order_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Invoices": {"columns": [[0, "invoice_number", "INTEGER", 0, null, 1], [1, "order_id", "INTEGER", 1, null, 0], [2, "invoice_date", "DATETIME", 0, null, 0]], "primary_keys": ["invoice_number"], "foreign_keys": [[0, 0, "Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Accounts": {"columns": [[0, "account_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "date_account_opened", "DATETIME", 0, null, 0], [3, "account_name", "VARCHAR(50)", 0, null, 0], [4, "other_account_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["account_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Product_Categories": {"columns": [[0, "production_type_code", "VARCHAR(15)", 0, null, 1], [1, "product_type_description", "VARCHAR(80)", 0, null, 0], [2, "vat_rating", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["production_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "production_type_code"]]], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "parent_product_id", "INTEGER", 0, null, 0], [2, "production_type_code", "VARCHAR(15)", 1, null, 0], [3, "unit_price", "DECIMAL(19,4)", 0, null, 0], [4, "product_name", "VARCHAR(80)", 0, null, 0], [5, "product_color", "VARCHAR(20)", 0, null, 0], [6, "product_size", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [[0, 0, "Product_Categories", "production_type_code", "production_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Financial_Transactions": {"columns": [[0, "transaction_id", "INTEGER", 1, null, 0], [1, "account_id", "INTEGER", 1, null, 0], [2, "invoice_number", "INTEGER", 0, null, 0], [3, "transaction_type", "VARCHAR(15)", 1, null, 0], [4, "transaction_date", "DATETIME", 0, null, 0], [5, "transaction_amount", "DECIMAL(19,4)", 0, null, 0], [6, "transaction_comment", "VARCHAR(255)", 0, null, 0], [7, "other_transaction_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Accounts", "account_id", "account_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoices", "invoice_number", "invoice_number", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "order_item_id", "INTEGER", 0, null, 1], [1, "order_id", "INTEGER", 1, null, 0], [2, "product_id", "INTEGER", 1, null, 0], [3, "product_quantity", "VARCHAR(50)", 0, null, 0], [4, "other_order_item_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["order_item_id"], "foreign_keys": [[0, 0, "Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Invoice_Line_Items": {"columns": [[0, "order_item_id", "INTEGER", 1, null, 0], [1, "invoice_number", "INTEGER", 1, null, 0], [2, "product_id", "INTEGER", 1, null, 0], [3, "product_title", "VARCHAR(80)", 0, null, 0], [4, "product_quantity", "VARCHAR(50)", 0, null, 0], [5, "product_price", "DECIMAL(19,4)", 0, null, 0], [6, "derived_product_cost", "DECIMAL(19,4)", 0, null, 0], [7, "derived_vat_payable", "DECIMAL(19,4)", 0, null, 0], [8, "derived_total_cost", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoices", "invoice_number", "invoice_number", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Order_Items", "order_item_id", "order_item_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
customer_first_name VARCHAR(50),
customer_middle_initial VARCHAR(1),
customer_last_name VARCHAR(50),
gender VARCHAR(1),
email_address VARCHAR(255),
login_name VARCHAR(80),
login_password VARCHAR(20),
phone_number VARCHAR(255),
town_city VARCHAR(50),
state_county_province VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
date_order_placed DATETIME NOT NULL,
order_details VARCHAR(255),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Invoices (
invoice_number INTEGER PRIMARY KEY,
order_id INTEGER NOT NULL,
invoice_date DATETIME,
FOREIGN KEY (order_id) REFERENCES Orders(order_id)
);
CREATE TABLE Accounts (
account_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Product_Categories (
production_type_code VARCHAR(15) PRIMARY KEY,
product_type_description VARCHAR(80),
vat_rating DECIMAL(19,4),
UNIQUE (production_type_code)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
parent_product_id INTEGER,
production_type_code VARCHAR(15) NOT NULL,
unit_price DECIMAL(19,4),
product_name VARCHAR(80),
product_color VARCHAR(20),
product_size VARCHAR(20),
FOREIGN KEY (production_type_code) REFERENCES Product_Categories(production_type_code)
);
CREATE TABLE Financial_Transactions (
transaction_id INTEGER NOT NULL,
account_id INTEGER NOT NULL,
invoice_number INTEGER,
transaction_type VARCHAR(15) NOT NULL,
transaction_date DATETIME,
transaction_amount DECIMAL(19,4),
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(255),
FOREIGN KEY (account_id) REFERENCES Accounts(account_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number)
);
CREATE TABLE Order_Items (
order_item_id INTEGER PRIMARY KEY,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
product_quantity VARCHAR(50),
other_order_item_details VARCHAR(255),
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
);
CREATE TABLE Invoice_Line_Items (
order_item_id INTEGER NOT NULL,
invoice_number INTEGER NOT NULL,
product_id INTEGER NOT NULL,
product_title VARCHAR(80),
product_quantity VARCHAR(50),
product_price DECIMAL(19,4),
derived_product_cost DECIMAL(19,4),
derived_vat_payable DECIMAL(19,4),
derived_total_cost DECIMAL(19,4),
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number),
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id)
); |
department_management | {"department": {"columns": [[0, "Department_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Creation", "TEXT", 0, null, 0], [3, "Ranking", "INT", 0, null, 0], [4, "Budget_in_Billions", "REAL", 0, null, 0], [5, "Num_Employees", "REAL", 0, null, 0]], "primary_keys": ["Department_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Department_ID"]]], "check_constraints": []}, "head": {"columns": [[0, "head_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "born_state", "TEXT", 0, null, 0], [3, "age", "REAL", 0, null, 0]], "primary_keys": ["head_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "head_ID"]]], "check_constraints": []}, "management": {"columns": [[0, "department_ID", "INT", 0, null, 1], [1, "head_ID", "INT", 0, null, 2], [2, "temporary_acting", "TEXT", 0, null, 0]], "primary_keys": ["department_ID", "head_ID"], "foreign_keys": [[0, 0, "head", "head_ID", "head_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "department", "department_ID", "Department_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "department_ID"], [1, 1, "head_ID"]]], "check_constraints": []}} | CREATE TABLE department (
Department_ID INT PRIMARY KEY,
Name TEXT,
Creation TEXT,
Ranking INT,
Budget_in_Billions REAL,
Num_Employees REAL,
UNIQUE (Department_ID)
);
CREATE TABLE head (
head_ID INT PRIMARY KEY,
name TEXT,
born_state TEXT,
age REAL,
UNIQUE (head_ID)
);
CREATE TABLE management (
department_ID INT PRIMARY KEY,
head_ID INT PRIMARY KEY,
temporary_acting TEXT,
PRIMARY KEY (department_ID, head_ID),
UNIQUE (department_ID, head_ID),
FOREIGN KEY (head_ID) REFERENCES head(head_ID),
FOREIGN KEY (department_ID) REFERENCES department(Department_ID)
); |
architecture | {"architect": {"columns": [[0, "id", "TEXT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "nationality", "TEXT", 0, null, 0], [3, "gender", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "bridge": {"columns": [[0, "architect_id", "INT", 0, null, 0], [1, "id", "INT", 0, null, 1], [2, "name", "TEXT", 0, null, 0], [3, "location", "TEXT", 0, null, 0], [4, "length_meters", "REAL", 0, null, 0], [5, "length_feet", "REAL", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "architect", "architect_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "id"]]], "check_constraints": []}, "mill": {"columns": [[0, "architect_id", "INT", 0, null, 0], [1, "id", "INT", 0, null, 1], [2, "location", "TEXT", 0, null, 0], [3, "name", "TEXT", 0, null, 0], [4, "type", "TEXT", 0, null, 0], [5, "built_year", "INT", 0, null, 0], [6, "notes", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "architect", "architect_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "id"]]], "check_constraints": []}} | CREATE TABLE architect (
id TEXT PRIMARY KEY,
name TEXT,
nationality TEXT,
gender TEXT,
UNIQUE (id)
);
CREATE TABLE bridge (
architect_id INT,
id INT PRIMARY KEY,
name TEXT,
location TEXT,
length_meters REAL,
length_feet REAL,
UNIQUE (id),
FOREIGN KEY (architect_id) REFERENCES architect(id)
);
CREATE TABLE mill (
architect_id INT,
id INT PRIMARY KEY,
location TEXT,
name TEXT,
type TEXT,
built_year INT,
notes TEXT,
UNIQUE (id),
FOREIGN KEY (architect_id) REFERENCES architect(id)
); |
medicine_enzyme_interaction | {"medicine": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Trade_Name", "TEXT", 0, null, 0], [3, "FDA_approved", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "enzyme": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Product", "TEXT", 0, null, 0], [4, "Chromosome", "TEXT", 0, null, 0], [5, "OMIM", "INT", 0, null, 0], [6, "Porphyria", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "medicine_enzyme_interaction": {"columns": [[0, "enzyme_id", "INT", 0, null, 1], [1, "medicine_id", "INT", 0, null, 2], [2, "interaction_type", "TEXT", 0, null, 0]], "primary_keys": ["enzyme_id", "medicine_id"], "foreign_keys": [[0, 0, "medicine", "medicine_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "enzyme", "enzyme_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "enzyme_id"], [1, 1, "medicine_id"]]], "check_constraints": []}} | CREATE TABLE medicine (
id INT PRIMARY KEY,
name TEXT,
Trade_Name TEXT,
FDA_approved TEXT,
UNIQUE (id)
);
CREATE TABLE enzyme (
id INT PRIMARY KEY,
name TEXT,
Location TEXT,
Product TEXT,
Chromosome TEXT,
OMIM INT,
Porphyria TEXT,
UNIQUE (id)
);
CREATE TABLE medicine_enzyme_interaction (
enzyme_id INT PRIMARY KEY,
medicine_id INT PRIMARY KEY,
interaction_type TEXT,
PRIMARY KEY (enzyme_id, medicine_id),
UNIQUE (enzyme_id, medicine_id),
FOREIGN KEY (medicine_id) REFERENCES medicine(id),
FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)
); |
epinions_1 | {"item": {"columns": [[0, "i_id", "INTEGER", 1, null, 1], [1, "title", "varchar(20)", 0, "NULL", 0]], "primary_keys": ["i_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "review": {"columns": [[0, "a_id", "INTEGER", 1, null, 1], [1, "u_id", "INTEGER", 1, null, 0], [2, "i_id", "INTEGER", 1, null, 0], [3, "rating", "INTEGER", 0, "NULL", 0], [4, "rank", "INTEGER", 0, "NULL", 0]], "primary_keys": ["a_id"], "foreign_keys": [[0, 0, "item", "i_id", "i_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "useracct", "u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "useracct": {"columns": [[0, "u_id", "INTEGER", 1, null, 1], [1, "name", "varchar(128)", 0, "NULL", 0]], "primary_keys": ["u_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "trust": {"columns": [[0, "source_u_id", "INTEGER", 1, null, 0], [1, "target_u_id", "INTEGER", 1, null, 0], [2, "trust", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "useracct", "target_u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "useracct", "source_u_id", "u_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE item (
i_id INTEGER NOT NULL PRIMARY KEY,
title varchar(20) DEFAULT NULL
);
CREATE TABLE review (
a_id INTEGER NOT NULL PRIMARY KEY,
u_id INTEGER NOT NULL,
i_id INTEGER NOT NULL,
rating INTEGER DEFAULT NULL,
rank INTEGER DEFAULT NULL,
FOREIGN KEY (i_id) REFERENCES item(i_id),
FOREIGN KEY (u_id) REFERENCES useracct(u_id)
);
CREATE TABLE useracct (
u_id INTEGER NOT NULL PRIMARY KEY,
name varchar(128) DEFAULT NULL
);
CREATE TABLE trust (
source_u_id INTEGER NOT NULL,
target_u_id INTEGER NOT NULL,
trust INTEGER NOT NULL,
FOREIGN KEY (target_u_id) REFERENCES useracct(u_id),
FOREIGN KEY (source_u_id) REFERENCES useracct(u_id)
); |
chinook_1 | {"Album": {"columns": [[0, "AlbumId", "INTEGER", 1, null, 1], [1, "Title", "varchar(160)", 1, null, 0], [2, "ArtistId", "INTEGER", 1, null, 0]], "primary_keys": ["AlbumId"], "foreign_keys": [[0, 0, "Artist", "ArtistId", "ArtistId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Artist": {"columns": [[0, "ArtistId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["ArtistId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer": {"columns": [[0, "CustomerId", "INTEGER", 1, null, 1], [1, "FirstName", "varchar(40)", 1, null, 0], [2, "LastName", "varchar(20)", 1, null, 0], [3, "Company", "varchar(80)", 0, "NULL", 0], [4, "Address", "varchar(70)", 0, "NULL", 0], [5, "City", "varchar(40)", 0, "NULL", 0], [6, "State", "varchar(40)", 0, "NULL", 0], [7, "Country", "varchar(40)", 0, "NULL", 0], [8, "PostalCode", "varchar(10)", 0, "NULL", 0], [9, "Phone", "varchar(24)", 0, "NULL", 0], [10, "Fax", "varchar(24)", 0, "NULL", 0], [11, "Email", "varchar(60)", 1, null, 0], [12, "SupportRepId", "INTEGER", 0, "NULL", 0]], "primary_keys": ["CustomerId"], "foreign_keys": [[0, 0, "Employee", "SupportRepId", "EmployeeId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Employee": {"columns": [[0, "EmployeeId", "INTEGER", 1, null, 1], [1, "LastName", "varchar(20)", 1, null, 0], [2, "FirstName", "varchar(20)", 1, null, 0], [3, "Title", "varchar(30)", 0, "NULL", 0], [4, "ReportsTo", "INTEGER", 0, "NULL", 0], [5, "BirthDate", "datetime", 0, "NULL", 0], [6, "HireDate", "datetime", 0, "NULL", 0], [7, "Address", "varchar(70)", 0, "NULL", 0], [8, "City", "varchar(40)", 0, "NULL", 0], [9, "State", "varchar(40)", 0, "NULL", 0], [10, "Country", "varchar(40)", 0, "NULL", 0], [11, "PostalCode", "varchar(10)", 0, "NULL", 0], [12, "Phone", "varchar(24)", 0, "NULL", 0], [13, "Fax", "varchar(24)", 0, "NULL", 0], [14, "Email", "varchar(60)", 0, "NULL", 0]], "primary_keys": ["EmployeeId"], "foreign_keys": [[0, 0, "Employee", "ReportsTo", "EmployeeId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Genre": {"columns": [[0, "GenreId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["GenreId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Invoice": {"columns": [[0, "InvoiceId", "INTEGER", 1, null, 1], [1, "CustomerId", "INTEGER", 1, null, 0], [2, "InvoiceDate", "datetime", 1, null, 0], [3, "BillingAddress", "varchar(70)", 0, "NULL", 0], [4, "BillingCity", "varchar(40)", 0, "NULL", 0], [5, "BillingState", "varchar(40)", 0, "NULL", 0], [6, "BillingCountry", "varchar(40)", 0, "NULL", 0], [7, "BillingPostalCode", "varchar(10)", 0, "NULL", 0], [8, "Total", "decimal(10,2)", 1, null, 0]], "primary_keys": ["InvoiceId"], "foreign_keys": [[0, 0, "Customer", "CustomerId", "CustomerId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "InvoiceLine": {"columns": [[0, "InvoiceLineId", "INTEGER", 1, null, 1], [1, "InvoiceId", "INTEGER", 1, null, 0], [2, "TrackId", "INTEGER", 1, null, 0], [3, "UnitPrice", "decimal(10,2)", 1, null, 0], [4, "Quantity", "INTEGER", 1, null, 0]], "primary_keys": ["InvoiceLineId"], "foreign_keys": [[0, 0, "Track", "TrackId", "TrackId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Invoice", "InvoiceId", "InvoiceId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "MediaType": {"columns": [[0, "MediaTypeId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["MediaTypeId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Playlist": {"columns": [[0, "PlaylistId", "INTEGER", 1, null, 1], [1, "Name", "varchar(120)", 0, "NULL", 0]], "primary_keys": ["PlaylistId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "PlaylistTrack": {"columns": [[0, "PlaylistId", "INTEGER", 1, null, 1], [1, "TrackId", "INTEGER", 1, null, 2]], "primary_keys": ["PlaylistId", "TrackId"], "foreign_keys": [[0, 0, "Track", "TrackId", "TrackId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Playlist", "PlaylistId", "PlaylistId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "PlaylistId"], [1, 1, "TrackId"]]], "check_constraints": []}, "Track": {"columns": [[0, "TrackId", "INTEGER", 1, null, 1], [1, "Name", "varchar(200)", 1, null, 0], [2, "AlbumId", "INTEGER", 0, "NULL", 0], [3, "MediaTypeId", "INTEGER", 1, null, 0], [4, "GenreId", "INTEGER", 0, "NULL", 0], [5, "Composer", "varchar(220)", 0, "NULL", 0], [6, "Milliseconds", "INTEGER", 1, null, 0], [7, "Bytes", "INTEGER", 0, "NULL", 0], [8, "UnitPrice", "decimal(10,2)", 1, null, 0]], "primary_keys": ["TrackId"], "foreign_keys": [[0, 0, "MediaType", "MediaTypeId", "MediaTypeId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Genre", "GenreId", "GenreId", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Album", "AlbumId", "AlbumId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Album (
AlbumId INTEGER NOT NULL PRIMARY KEY,
Title varchar(160) NOT NULL,
ArtistId INTEGER NOT NULL,
FOREIGN KEY (ArtistId) REFERENCES Artist(ArtistId)
);
CREATE TABLE Artist (
ArtistId INTEGER NOT NULL PRIMARY KEY,
Name varchar(120) DEFAULT NULL
);
CREATE TABLE Customer (
CustomerId INTEGER NOT NULL PRIMARY KEY,
FirstName varchar(40) NOT NULL,
LastName varchar(20) NOT NULL,
Company varchar(80) DEFAULT NULL,
Address varchar(70) DEFAULT NULL,
City varchar(40) DEFAULT NULL,
State varchar(40) DEFAULT NULL,
Country varchar(40) DEFAULT NULL,
PostalCode varchar(10) DEFAULT NULL,
Phone varchar(24) DEFAULT NULL,
Fax varchar(24) DEFAULT NULL,
Email varchar(60) NOT NULL,
SupportRepId INTEGER DEFAULT NULL,
FOREIGN KEY (SupportRepId) REFERENCES Employee(EmployeeId)
);
CREATE TABLE Employee (
EmployeeId INTEGER NOT NULL PRIMARY KEY,
LastName varchar(20) NOT NULL,
FirstName varchar(20) NOT NULL,
Title varchar(30) DEFAULT NULL,
ReportsTo INTEGER DEFAULT NULL,
BirthDate datetime DEFAULT NULL,
HireDate datetime DEFAULT NULL,
Address varchar(70) DEFAULT NULL,
City varchar(40) DEFAULT NULL,
State varchar(40) DEFAULT NULL,
Country varchar(40) DEFAULT NULL,
PostalCode varchar(10) DEFAULT NULL,
Phone varchar(24) DEFAULT NULL,
Fax varchar(24) DEFAULT NULL,
Email varchar(60) DEFAULT NULL,
FOREIGN KEY (ReportsTo) REFERENCES Employee(EmployeeId)
);
CREATE TABLE Genre (
GenreId INTEGER NOT NULL PRIMARY KEY,
Name varchar(120) DEFAULT NULL
);
CREATE TABLE Invoice (
InvoiceId INTEGER NOT NULL PRIMARY KEY,
CustomerId INTEGER NOT NULL,
InvoiceDate datetime NOT NULL,
BillingAddress varchar(70) DEFAULT NULL,
BillingCity varchar(40) DEFAULT NULL,
BillingState varchar(40) DEFAULT NULL,
BillingCountry varchar(40) DEFAULT NULL,
BillingPostalCode varchar(10) DEFAULT NULL,
Total decimal(10,2) NOT NULL,
FOREIGN KEY (CustomerId) REFERENCES Customer(CustomerId)
);
CREATE TABLE InvoiceLine (
InvoiceLineId INTEGER NOT NULL PRIMARY KEY,
InvoiceId INTEGER NOT NULL,
TrackId INTEGER NOT NULL,
UnitPrice decimal(10,2) NOT NULL,
Quantity INTEGER NOT NULL,
FOREIGN KEY (TrackId) REFERENCES Track(TrackId),
FOREIGN KEY (InvoiceId) REFERENCES Invoice(InvoiceId)
);
CREATE TABLE MediaType (
MediaTypeId INTEGER NOT NULL PRIMARY KEY,
Name varchar(120) DEFAULT NULL
);
CREATE TABLE Playlist (
PlaylistId INTEGER NOT NULL PRIMARY KEY,
Name varchar(120) DEFAULT NULL
);
CREATE TABLE PlaylistTrack (
PlaylistId INTEGER NOT NULL PRIMARY KEY,
TrackId INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (PlaylistId, TrackId),
UNIQUE (PlaylistId, TrackId),
FOREIGN KEY (TrackId) REFERENCES Track(TrackId),
FOREIGN KEY (PlaylistId) REFERENCES Playlist(PlaylistId)
);
CREATE TABLE Track (
TrackId INTEGER NOT NULL PRIMARY KEY,
Name varchar(200) NOT NULL,
AlbumId INTEGER DEFAULT NULL,
MediaTypeId INTEGER NOT NULL,
GenreId INTEGER DEFAULT NULL,
Composer varchar(220) DEFAULT NULL,
Milliseconds INTEGER NOT NULL,
Bytes INTEGER DEFAULT NULL,
UnitPrice decimal(10,2) NOT NULL,
FOREIGN KEY (MediaTypeId) REFERENCES MediaType(MediaTypeId),
FOREIGN KEY (GenreId) REFERENCES Genre(GenreId),
FOREIGN KEY (AlbumId) REFERENCES Album(AlbumId)
); |
loan_1 | {"bank": {"columns": [[0, "branch_ID", "INT", 0, null, 1], [1, "bname", "varchar(20)", 0, null, 0], [2, "no_of_customers", "INT", 0, null, 0], [3, "city", "varchar(10)", 0, null, 0], [4, "state", "varchar(20)", 0, null, 0]], "primary_keys": ["branch_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "branch_ID"]]], "check_constraints": []}, "customer": {"columns": [[0, "cust_ID", "varchar(3)", 0, null, 1], [1, "cust_name", "varchar(20)", 0, null, 0], [2, "acc_type", "char(1)", 0, null, 0], [3, "acc_bal", "INT", 0, null, 0], [4, "no_of_loans", "INT", 0, null, 0], [5, "credit_score", "INT", 0, null, 0], [6, "branch_ID", "INT", 0, null, 0], [7, "state", "varchar(20)", 0, null, 0]], "primary_keys": ["cust_ID"], "foreign_keys": [[0, 0, "bank", "branch_ID", "branch_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "cust_ID"]]], "check_constraints": []}, "loan": {"columns": [[0, "loan_ID", "varchar(3)", 0, null, 1], [1, "loan_type", "varchar(15)", 0, null, 0], [2, "cust_ID", "varchar(3)", 0, null, 0], [3, "branch_ID", "varchar(3)", 0, null, 0], [4, "amount", "INT", 0, null, 0]], "primary_keys": ["loan_ID"], "foreign_keys": [[0, 0, "customer", "cust_ID", "Cust_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "bank", "branch_ID", "branch_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "loan_ID"]]], "check_constraints": []}} | CREATE TABLE bank (
branch_ID INT PRIMARY KEY,
bname varchar(20),
no_of_customers INT,
city varchar(10),
state varchar(20),
UNIQUE (branch_ID)
);
CREATE TABLE customer (
cust_ID varchar(3) PRIMARY KEY,
cust_name varchar(20),
acc_type char(1),
acc_bal INT,
no_of_loans INT,
credit_score INT,
branch_ID INT,
state varchar(20),
UNIQUE (cust_ID),
FOREIGN KEY (branch_ID) REFERENCES bank(branch_ID)
);
CREATE TABLE loan (
loan_ID varchar(3) PRIMARY KEY,
loan_type varchar(15),
cust_ID varchar(3),
branch_ID varchar(3),
amount INT,
UNIQUE (loan_ID),
FOREIGN KEY (cust_ID) REFERENCES customer(Cust_ID),
FOREIGN KEY (branch_ID) REFERENCES bank(branch_ID)
); |
party_host | {"party": {"columns": [[0, "Party_ID", "INT", 0, null, 1], [1, "Party_Theme", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "First_year", "TEXT", 0, null, 0], [4, "Last_year", "TEXT", 0, null, 0], [5, "Number_of_hosts", "INT", 0, null, 0]], "primary_keys": ["Party_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Party_ID"]]], "check_constraints": []}, "host": {"columns": [[0, "Host_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Nationality", "TEXT", 0, null, 0], [3, "Age", "TEXT", 0, null, 0]], "primary_keys": ["Host_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Host_ID"]]], "check_constraints": []}, "party_host": {"columns": [[0, "Party_ID", "INT", 0, null, 1], [1, "Host_ID", "INT", 0, null, 2], [2, "Is_Main_in_Charge", "bool", 0, null, 0]], "primary_keys": ["Party_ID", "Host_ID"], "foreign_keys": [[0, 0, "party", "Party_ID", "Party_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "host", "Host_ID", "Host_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Party_ID"], [1, 1, "Host_ID"]]], "check_constraints": []}} | CREATE TABLE party (
Party_ID INT PRIMARY KEY,
Party_Theme TEXT,
Location TEXT,
First_year TEXT,
Last_year TEXT,
Number_of_hosts INT,
UNIQUE (Party_ID)
);
CREATE TABLE host (
Host_ID INT PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Age TEXT,
UNIQUE (Host_ID)
);
CREATE TABLE party_host (
Party_ID INT PRIMARY KEY,
Host_ID INT PRIMARY KEY,
Is_Main_in_Charge bool,
PRIMARY KEY (Party_ID, Host_ID),
UNIQUE (Party_ID, Host_ID),
FOREIGN KEY (Party_ID) REFERENCES party(Party_ID),
FOREIGN KEY (Host_ID) REFERENCES host(Host_ID)
); |
music_2 | {"Songs": {"columns": [[0, "SongId", "INTEGER", 0, null, 1], [1, "Title", "TEXT", 0, null, 0]], "primary_keys": ["SongId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Albums": {"columns": [[0, "AId", "INTEGER", 0, null, 1], [1, "Title", "TEXT", 0, null, 0], [2, "Year", "INTEGER", 0, null, 0], [3, "Label", "TEXT", 0, null, 0], [4, "Type", "TEXT", 0, null, 0]], "primary_keys": ["AId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Band": {"columns": [[0, "Id", "INTEGER", 0, null, 1], [1, "Firstname", "TEXT", 0, null, 0], [2, "Lastname", "TEXT", 0, null, 0]], "primary_keys": ["Id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Instruments": {"columns": [[0, "SongId", "INTEGER", 0, null, 1], [1, "BandmateId", "INTEGER", 0, null, 2], [2, "Instrument", "TEXT", 0, null, 3]], "primary_keys": ["SongId", "BandmateId", "Instrument"], "foreign_keys": [[0, 0, "Band", "BandmateId", "Id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Songs", "SongId", "SongId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "SongId"], [1, 1, "BandmateId"], [2, 2, "Instrument"]]], "check_constraints": []}, "Performance": {"columns": [[0, "SongId", "INTEGER", 0, null, 1], [1, "Bandmate", "INTEGER", 0, null, 2], [2, "StagePosition", "TEXT", 0, null, 0]], "primary_keys": ["SongId", "Bandmate"], "foreign_keys": [[0, 0, "Band", "Bandmate", "Id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Songs", "SongId", "SongId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "SongId"], [1, 1, "Bandmate"]]], "check_constraints": []}, "Tracklists": {"columns": [[0, "AlbumId", "INTEGER", 0, null, 1], [1, "Position", "INTEGER", 0, null, 2], [2, "SongId", "INTEGER", 0, null, 0]], "primary_keys": ["AlbumId", "Position"], "foreign_keys": [[0, 0, "Albums", "AlbumId", "AId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Songs", "SongId", "SongId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "AlbumId"], [1, 1, "Position"]]], "check_constraints": []}, "Vocals": {"columns": [[0, "SongId", "INTEGER", 0, null, 1], [1, "Bandmate", "INTEGER", 0, null, 2], [2, "Type", "TEXT", 0, null, 0]], "primary_keys": ["SongId", "Bandmate"], "foreign_keys": [[0, 0, "Band", "Bandmate", "Id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Songs", "SongId", "SongId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "SongId"], [1, 1, "Bandmate"]]], "check_constraints": []}} | CREATE TABLE Songs (
SongId INTEGER PRIMARY KEY,
Title TEXT
);
CREATE TABLE Albums (
AId INTEGER PRIMARY KEY,
Title TEXT,
Year INTEGER,
Label TEXT,
Type TEXT
);
CREATE TABLE Band (
Id INTEGER PRIMARY KEY,
Firstname TEXT,
Lastname TEXT
);
CREATE TABLE Instruments (
SongId INTEGER PRIMARY KEY,
BandmateId INTEGER PRIMARY KEY,
Instrument TEXT PRIMARY KEY,
PRIMARY KEY (SongId, BandmateId, Instrument),
UNIQUE (SongId, BandmateId, Instrument),
FOREIGN KEY (BandmateId) REFERENCES Band(Id),
FOREIGN KEY (SongId) REFERENCES Songs(SongId)
);
CREATE TABLE Performance (
SongId INTEGER PRIMARY KEY,
Bandmate INTEGER PRIMARY KEY,
StagePosition TEXT,
PRIMARY KEY (SongId, Bandmate),
UNIQUE (SongId, Bandmate),
FOREIGN KEY (Bandmate) REFERENCES Band(Id),
FOREIGN KEY (SongId) REFERENCES Songs(SongId)
);
CREATE TABLE Tracklists (
AlbumId INTEGER PRIMARY KEY,
Position INTEGER PRIMARY KEY,
SongId INTEGER,
PRIMARY KEY (AlbumId, Position),
UNIQUE (AlbumId, Position),
FOREIGN KEY (AlbumId) REFERENCES Albums(AId),
FOREIGN KEY (SongId) REFERENCES Songs(SongId)
);
CREATE TABLE Vocals (
SongId INTEGER PRIMARY KEY,
Bandmate INTEGER PRIMARY KEY,
Type TEXT,
PRIMARY KEY (SongId, Bandmate),
UNIQUE (SongId, Bandmate),
FOREIGN KEY (Bandmate) REFERENCES Band(Id),
FOREIGN KEY (SongId) REFERENCES Songs(SongId)
); |
manufactory_1 | {"Manufacturers": {"columns": [[0, "Code", "INTEGER", 0, null, 1], [1, "Name", "VARCHAR(255)", 1, null, 0], [2, "Headquarter", "VARCHAR(255)", 1, null, 0], [3, "Founder", "VARCHAR(255)", 1, null, 0], [4, "Revenue", "REAL", 0, null, 0]], "primary_keys": ["Code"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "Code", "INTEGER", 0, null, 1], [1, "Name", "VARCHAR(255)", 1, null, 0], [2, "Price", "DECIMAL", 1, null, 0], [3, "Manufacturer", "INTEGER", 1, null, 0]], "primary_keys": ["Code"], "foreign_keys": [[0, 0, "Manufacturers", "Manufacturer", "Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Manufacturers (
Code INTEGER PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
Headquarter VARCHAR(255) NOT NULL,
Founder VARCHAR(255) NOT NULL,
Revenue REAL
);
CREATE TABLE Products (
Code INTEGER PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
Price DECIMAL NOT NULL,
Manufacturer INTEGER NOT NULL,
FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)
); |
dorm_1 | {"Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Dorm": {"columns": [[0, "dormid", "INTEGER", 0, null, 0], [1, "dorm_name", "VARCHAR(20)", 0, null, 0], [2, "student_capacity", "INTEGER", 0, null, 0], [3, "gender", "VARCHAR(1)", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Dorm_amenity": {"columns": [[0, "amenid", "INTEGER", 0, null, 0], [1, "amenity_name", "VARCHAR(25)", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Has_amenity": {"columns": [[0, "dormid", "INTEGER", 0, null, 0], [1, "amenid", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Dorm_amenity", "amenid", "amenid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Dorm", "dormid", "dormid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Lives_in": {"columns": [[0, "stuid", "INTEGER", 0, null, 0], [1, "dormid", "INTEGER", 0, null, 0], [2, "room_number", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Dorm", "dormid", "dormid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "stuid", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
);
CREATE TABLE Dorm_amenity (
amenid INTEGER,
amenity_name VARCHAR(25)
);
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER,
FOREIGN KEY (amenid) REFERENCES Dorm_amenity(amenid),
FOREIGN KEY (dormid) REFERENCES Dorm(dormid)
);
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER,
FOREIGN KEY (dormid) REFERENCES Dorm(dormid),
FOREIGN KEY (stuid) REFERENCES Student(StuID)
); |
customers_and_products_contacts | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "line_1_number_building", "VARCHAR(80)", 0, null, 0], [2, "city", "VARCHAR(50)", 0, null, 0], [3, "zip_postcode", "VARCHAR(20)", 0, null, 0], [4, "state_province_county", "VARCHAR(50)", 0, null, 0], [5, "country", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_type_code", "VARCHAR(15)", 0, null, 0], [2, "product_name", "VARCHAR(80)", 0, null, 0], [3, "product_price", "DOUBLE", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "payment_method_code", "VARCHAR(15)", 0, null, 0], [2, "customer_number", "VARCHAR(20)", 0, null, 0], [3, "customer_name", "VARCHAR(80)", 0, null, 0], [4, "customer_address", "VARCHAR(255)", 0, null, 0], [5, "customer_phone", "VARCHAR(80)", 0, null, 0], [6, "customer_email", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Contacts": {"columns": [[0, "contact_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "gender", "VARCHAR(1)", 0, null, 0], [3, "first_name", "VARCHAR(80)", 0, null, 0], [4, "last_name", "VARCHAR(50)", 0, null, 0], [5, "contact_phone", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["contact_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Address_History": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "address_id", "INTEGER", 1, null, 0], [2, "date_from", "DATETIME", 1, null, 0], [3, "date_to", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "order_date", "DATETIME", 1, null, 0], [3, "order_status_code", "VARCHAR(15)", 0, null, 0]], "primary_keys": ["order_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "order_item_id", "INTEGER", 1, null, 0], [1, "order_id", "INTEGER", 1, null, 0], [2, "product_id", "INTEGER", 1, null, 0], [3, "order_quantity", "VARCHAR(80)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customer_Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
line_1_number_building VARCHAR(80),
city VARCHAR(50),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_type_code VARCHAR(15),
product_name VARCHAR(80),
product_price DOUBLE
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
payment_method_code VARCHAR(15),
customer_number VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80)
);
CREATE TABLE Contacts (
contact_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
gender VARCHAR(1),
first_name VARCHAR(80),
last_name VARCHAR(50),
contact_phone VARCHAR(80)
);
CREATE TABLE Customer_Address_History (
customer_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME NOT NULL,
date_to DATETIME,
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Customer_Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_date DATETIME NOT NULL,
order_status_code VARCHAR(15),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
order_item_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
order_quantity VARCHAR(80),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
); |
driving_school | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "line_1_number_building", "VARCHAR(80)", 0, null, 0], [2, "city", "VARCHAR(50)", 0, null, 0], [3, "zip_postcode", "VARCHAR(20)", 0, null, 0], [4, "state_province_county", "VARCHAR(50)", 0, null, 0], [5, "country", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Staff": {"columns": [[0, "staff_id", "INTEGER", 0, null, 1], [1, "staff_address_id", "INTEGER", 1, null, 0], [2, "nickname", "VARCHAR(80)", 0, null, 0], [3, "first_name", "VARCHAR(80)", 0, null, 0], [4, "middle_name", "VARCHAR(80)", 0, null, 0], [5, "last_name", "VARCHAR(80)", 0, null, 0], [6, "date_of_birth", "DATETIME", 0, null, 0], [7, "date_joined_staff", "DATETIME", 0, null, 0], [8, "date_left_staff", "DATETIME", 0, null, 0]], "primary_keys": ["staff_id"], "foreign_keys": [[0, 0, "Addresses", "staff_address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Vehicles": {"columns": [[0, "vehicle_id", "INTEGER", 0, null, 1], [1, "vehicle_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["vehicle_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "customer_address_id", "INTEGER", 1, null, 0], [2, "customer_status_code", "VARCHAR(15)", 1, null, 0], [3, "date_became_customer", "DATETIME", 0, null, 0], [4, "date_of_birth", "DATETIME", 0, null, 0], [5, "first_name", "VARCHAR(80)", 0, null, 0], [6, "last_name", "VARCHAR(80)", 0, null, 0], [7, "amount_outstanding", "DOUBLE", 0, null, 0], [8, "email_address", "VARCHAR(250)", 0, null, 0], [9, "phone_number", "VARCHAR(255)", 0, null, 0], [10, "cell_mobile_phone_number", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [[0, 0, "Addresses", "customer_address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Payments": {"columns": [[0, "customer_id", "INTEGER", 1, null, 1], [1, "datetime_payment", "DATETIME", 1, null, 2], [2, "payment_method_code", "VARCHAR(10)", 1, null, 0], [3, "amount_payment", "DOUBLE", 0, null, 0]], "primary_keys": ["customer_id", "datetime_payment"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "customer_id"], [1, 1, "datetime_payment"]]], "check_constraints": []}, "Lessons": {"columns": [[0, "lesson_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "lesson_status_code", "VARCHAR(15)", 1, null, 0], [3, "staff_id", "INTEGER", 0, null, 0], [4, "vehicle_id", "INTEGER", 1, null, 0], [5, "lesson_date", "DATETIME", 0, null, 0], [6, "lesson_time", "VARCHAR(10)", 0, null, 0], [7, "price", "DOUBLE", 0, null, 0]], "primary_keys": ["lesson_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Staff", "staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Vehicles", "vehicle_id", "vehicle_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
line_1_number_building VARCHAR(80),
city VARCHAR(50),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE Staff (
staff_id INTEGER PRIMARY KEY,
staff_address_id INTEGER NOT NULL,
nickname VARCHAR(80),
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
date_of_birth DATETIME,
date_joined_staff DATETIME,
date_left_staff DATETIME,
FOREIGN KEY (staff_address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Vehicles (
vehicle_id INTEGER PRIMARY KEY,
vehicle_details VARCHAR(255)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
customer_address_id INTEGER NOT NULL,
customer_status_code VARCHAR(15) NOT NULL,
date_became_customer DATETIME,
date_of_birth DATETIME,
first_name VARCHAR(80),
last_name VARCHAR(80),
amount_outstanding DOUBLE,
email_address VARCHAR(250),
phone_number VARCHAR(255),
cell_mobile_phone_number VARCHAR(255),
FOREIGN KEY (customer_address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Customer_Payments (
customer_id INTEGER NOT NULL PRIMARY KEY,
datetime_payment DATETIME NOT NULL PRIMARY KEY,
payment_method_code VARCHAR(10) NOT NULL,
amount_payment DOUBLE,
PRIMARY KEY (customer_id, datetime_payment),
UNIQUE (customer_id, datetime_payment),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Lessons (
lesson_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
lesson_status_code VARCHAR(15) NOT NULL,
staff_id INTEGER,
vehicle_id INTEGER NOT NULL,
lesson_date DATETIME,
lesson_time VARCHAR(10),
price DOUBLE,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (vehicle_id) REFERENCES Vehicles(vehicle_id)
); |
battle_death | {"battle": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "date", "TEXT", 0, null, 0], [3, "bulgarian_commander", "TEXT", 0, null, 0], [4, "latin_commander", "TEXT", 0, null, 0], [5, "result", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "ship": {"columns": [[0, "lost_in_battle", "INT", 0, null, 0], [1, "id", "INT", 0, null, 1], [2, "name", "TEXT", 0, null, 0], [3, "tonnage", "TEXT", 0, null, 0], [4, "ship_type", "TEXT", 0, null, 0], [5, "location", "TEXT", 0, null, 0], [6, "disposition_of_ship", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "battle", "lost_in_battle", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "id"]]], "check_constraints": []}, "death": {"columns": [[0, "caused_by_ship_id", "INT", 0, null, 0], [1, "id", "INT", 0, null, 1], [2, "note", "TEXT", 0, null, 0], [3, "killed", "INT", 0, null, 0], [4, "injured", "INT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "ship", "caused_by_ship_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "id"]]], "check_constraints": []}} | CREATE TABLE battle (
id INT PRIMARY KEY,
name TEXT,
date TEXT,
bulgarian_commander TEXT,
latin_commander TEXT,
result TEXT,
UNIQUE (id)
);
CREATE TABLE ship (
lost_in_battle INT,
id INT PRIMARY KEY,
name TEXT,
tonnage TEXT,
ship_type TEXT,
location TEXT,
disposition_of_ship TEXT,
UNIQUE (id),
FOREIGN KEY (lost_in_battle) REFERENCES battle(id)
);
CREATE TABLE death (
caused_by_ship_id INT,
id INT PRIMARY KEY,
note TEXT,
killed INT,
injured INT,
UNIQUE (id),
FOREIGN KEY (caused_by_ship_id) REFERENCES ship(id)
); |
ship_1 | {"captain": {"columns": [[0, "Captain_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Ship_ID", "INT", 0, null, 0], [3, "age", "TEXT", 0, null, 0], [4, "Class", "TEXT", 0, null, 0], [5, "Rank", "TEXT", 0, null, 0]], "primary_keys": ["Captain_ID"], "foreign_keys": [[0, 0, "Ship", "Ship_ID", "Ship_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Captain_ID"]]], "check_constraints": []}, "Ship": {"columns": [[0, "Ship_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Type", "TEXT", 0, null, 0], [3, "Built_Year", "REAL", 0, null, 0], [4, "Class", "TEXT", 0, null, 0], [5, "Flag", "TEXT", 0, null, 0]], "primary_keys": ["Ship_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Ship_ID"]]], "check_constraints": []}} | CREATE TABLE captain (
Captain_ID INT PRIMARY KEY,
Name TEXT,
Ship_ID INT,
age TEXT,
Class TEXT,
Rank TEXT,
UNIQUE (Captain_ID),
FOREIGN KEY (Ship_ID) REFERENCES Ship(Ship_ID)
);
CREATE TABLE Ship (
Ship_ID INT PRIMARY KEY,
Name TEXT,
Type TEXT,
Built_Year REAL,
Class TEXT,
Flag TEXT,
UNIQUE (Ship_ID)
); |
yelp | {"business": {"columns": [[0, "bid", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "full_address", "TEXT", 0, null, 0], [4, "city", "TEXT", 0, null, 0], [5, "latitude", "TEXT", 0, null, 0], [6, "longitude", "TEXT", 0, null, 0], [7, "review_count", "INT", 0, null, 0], [8, "is_open", "INT", 0, null, 0], [9, "rating", "REAL", 0, null, 0], [10, "state", "TEXT", 0, null, 0]], "primary_keys": ["bid"], "foreign_keys": [], "unique_constraints": [[[0, 0, "bid"]]], "check_constraints": []}, "category": {"columns": [[0, "id", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "category_name", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "business", "business_id", "business_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "user": {"columns": [[0, "uid", "INT", 0, null, 1], [1, "user_id", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0]], "primary_keys": ["uid"], "foreign_keys": [], "unique_constraints": [[[0, 0, "uid"]]], "check_constraints": []}, "checkin": {"columns": [[0, "cid", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "count", "INT", 0, null, 0], [3, "day", "TEXT", 0, null, 0]], "primary_keys": ["cid"], "foreign_keys": [[0, 0, "business", "business_id", "business_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "cid"]]], "check_constraints": ["CREATE TABLE \"checkin\" ("]}, "neighbourhood": {"columns": [[0, "id", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "neighbourhood_name", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "business", "business_id", "business_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "review": {"columns": [[0, "rid", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "user_id", "TEXT", 0, null, 0], [3, "rating", "REAL", 0, null, 0], [4, "text", "TEXT", 0, null, 0], [5, "year", "INT", 0, null, 0], [6, "month", "TEXT", 0, null, 0]], "primary_keys": ["rid"], "foreign_keys": [[0, 0, "user", "user_id", "user_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "business", "business_id", "business_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "rid"]]], "check_constraints": []}, "tip": {"columns": [[0, "tip_id", "INT", 0, null, 1], [1, "business_id", "TEXT", 0, null, 0], [2, "text", "TEXT", 0, null, 0], [3, "user_id", "TEXT", 0, null, 0], [4, "likes", "INT", 0, null, 0], [5, "year", "INT", 0, null, 0], [6, "month", "TEXT", 0, null, 0]], "primary_keys": ["tip_id"], "foreign_keys": [[0, 0, "user", "user_id", "user_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "business", "business_id", "business_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "tip_id"]]], "check_constraints": []}} | CREATE TABLE business (
bid INT PRIMARY KEY,
business_id TEXT,
name TEXT,
full_address TEXT,
city TEXT,
latitude TEXT,
longitude TEXT,
review_count INT,
is_open INT,
rating REAL,
state TEXT,
UNIQUE (bid)
);
CREATE TABLE category (
id INT PRIMARY KEY,
business_id TEXT,
category_name TEXT,
UNIQUE (id),
FOREIGN KEY (business_id) REFERENCES business(business_id)
);
CREATE TABLE user (
uid INT PRIMARY KEY,
user_id TEXT,
name TEXT,
UNIQUE (uid)
);
CREATE TABLE checkin (
cid INT PRIMARY KEY,
business_id TEXT,
count INT,
day TEXT,
UNIQUE (cid),
FOREIGN KEY (business_id) REFERENCES business(business_id),
CREATE TABLE "checkin" (
);
CREATE TABLE neighbourhood (
id INT PRIMARY KEY,
business_id TEXT,
neighbourhood_name TEXT,
UNIQUE (id),
FOREIGN KEY (business_id) REFERENCES business(business_id)
);
CREATE TABLE review (
rid INT PRIMARY KEY,
business_id TEXT,
user_id TEXT,
rating REAL,
text TEXT,
year INT,
month TEXT,
UNIQUE (rid),
FOREIGN KEY (user_id) REFERENCES user(user_id),
FOREIGN KEY (business_id) REFERENCES business(business_id)
);
CREATE TABLE tip (
tip_id INT PRIMARY KEY,
business_id TEXT,
text TEXT,
user_id TEXT,
likes INT,
year INT,
month TEXT,
UNIQUE (tip_id),
FOREIGN KEY (user_id) REFERENCES user(user_id),
FOREIGN KEY (business_id) REFERENCES business(business_id)
); |
allergy_1 | {"Allergy_Type": {"columns": [[0, "Allergy", "VARCHAR(20)", 0, null, 1], [1, "AllergyType", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["Allergy"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Allergy"]]], "check_constraints": []}, "Has_Allergy": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "Allergy", "VARCHAR(20)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Allergy_Type", "Allergy", "Allergy", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "StuID", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Allergy_Type (
Allergy VARCHAR(20) PRIMARY KEY,
AllergyType VARCHAR(20),
UNIQUE (Allergy)
);
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20),
FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),
FOREIGN KEY (StuID) REFERENCES Student(StuID)
);
CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
); |
cre_Docs_and_Epenses | {"Ref_Document_Types": {"columns": [[0, "Document_Type_Code", "CHAR(15)", 1, null, 1], [1, "Document_Type_Name", "VARCHAR(255)", 1, null, 0], [2, "Document_Type_Description", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Document_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Document_Type_Code"]]], "check_constraints": []}, "Ref_Budget_Codes": {"columns": [[0, "Budget_Type_Code", "CHAR(15)", 1, null, 1], [1, "Budget_Type_Description", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Budget_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Budget_Type_Code"]]], "check_constraints": []}, "Projects": {"columns": [[0, "Project_ID", "INTEGER", 1, null, 1], [1, "Project_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Project_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Documents": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Document_Type_Code", "CHAR(15)", 1, null, 0], [2, "Project_ID", "INTEGER", 1, null, 0], [3, "Document_Date", "DATETIME", 0, null, 0], [4, "Document_Name", "VARCHAR(255)", 0, null, 0], [5, "Document_Description", "VARCHAR(255)", 0, null, 0], [6, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Projects", "Project_ID", "Project_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Document_Types", "Document_Type_Code", "Document_Type_Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Statements": {"columns": [[0, "Statement_ID", "INTEGER", 1, null, 1], [1, "Statement_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Statement_ID"], "foreign_keys": [[0, 0, "Documents", "Statement_ID", "Document_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Documents_with_Expenses": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Budget_Type_Code", "CHAR(15)", 1, null, 0], [2, "Document_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Documents", "Document_ID", "Document_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Budget_Codes", "Budget_Type_Code", "Budget_Type_Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Accounts": {"columns": [[0, "Account_ID", "INTEGER", 1, null, 1], [1, "Statement_ID", "INTEGER", 1, null, 0], [2, "Account_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Account_ID"], "foreign_keys": [[0, 0, "Statements", "Statement_ID", "Statement_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
UNIQUE (Document_Type_Code)
);
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Budget_Type_Description VARCHAR(255) NOT NULL,
UNIQUE (Budget_Type_Code)
);
CREATE TABLE Projects (
Project_ID INTEGER NOT NULL PRIMARY KEY,
Project_Details VARCHAR(255)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL PRIMARY KEY,
Document_Type_Code CHAR(15) NOT NULL,
Project_ID INTEGER NOT NULL,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
FOREIGN KEY (Project_ID) REFERENCES Projects(Project_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types(Document_Type_Code)
);
CREATE TABLE Statements (
Statement_ID INTEGER NOT NULL PRIMARY KEY,
Statement_Details VARCHAR(255),
FOREIGN KEY (Statement_ID) REFERENCES Documents(Document_ID)
);
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER NOT NULL PRIMARY KEY,
Budget_Type_Code CHAR(15) NOT NULL,
Document_Details VARCHAR(255),
FOREIGN KEY (Document_ID) REFERENCES Documents(Document_ID),
FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes(Budget_Type_Code)
);
CREATE TABLE Accounts (
Account_ID INTEGER NOT NULL PRIMARY KEY,
Statement_ID INTEGER NOT NULL,
Account_Details VARCHAR(255),
FOREIGN KEY (Statement_ID) REFERENCES Statements(Statement_ID)
); |
products_for_hire | {"Discount_Coupons": {"columns": [[0, "coupon_id", "INTEGER", 0, null, 1], [1, "date_issued", "DATETIME", 0, null, 0], [2, "coupon_amount", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["coupon_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "coupon_id", "INTEGER", 1, null, 0], [2, "good_or_bad_customer", "VARCHAR(4)", 0, null, 0], [3, "first_name", "VARCHAR(80)", 0, null, 0], [4, "last_name", "VARCHAR(80)", 0, null, 0], [5, "gender_mf", "VARCHAR(1)", 0, null, 0], [6, "date_became_customer", "DATETIME", 0, null, 0], [7, "date_last_hire", "DATETIME", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [[0, 0, "Discount_Coupons", "coupon_id", "coupon_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Bookings": {"columns": [[0, "booking_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "booking_status_code", "VARCHAR(10)", 1, null, 0], [3, "returned_damaged_yn", "VARCHAR(40)", 0, null, 0], [4, "booking_start_date", "DATETIME", 0, null, 0], [5, "booking_end_date", "DATETIME", 0, null, 0], [6, "count_hired", "VARCHAR(40)", 0, null, 0], [7, "amount_payable", "DECIMAL(19,4)", 0, null, 0], [8, "amount_of_discount", "DECIMAL(19,4)", 0, null, 0], [9, "amount_outstanding", "DECIMAL(19,4)", 0, null, 0], [10, "amount_of_refund", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["booking_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Products_for_Hire": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_type_code", "VARCHAR(15)", 1, null, 0], [2, "daily_hire_cost", "DECIMAL(19,4)", 0, null, 0], [3, "product_name", "VARCHAR(80)", 0, null, 0], [4, "product_description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Payments": {"columns": [[0, "payment_id", "INTEGER", 0, null, 1], [1, "booking_id", "INTEGER", 0, null, 0], [2, "customer_id", "INTEGER", 1, null, 0], [3, "payment_type_code", "VARCHAR(15)", 1, null, 0], [4, "amount_paid_in_full_yn", "VARCHAR(1)", 0, null, 0], [5, "payment_date", "DATETIME", 0, null, 0], [6, "amount_due", "DECIMAL(19,4)", 0, null, 0], [7, "amount_paid", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["payment_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "booking_id", "booking_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Products_Booked": {"columns": [[0, "booking_id", "INTEGER", 1, null, 1], [1, "product_id", "INTEGER", 1, null, 2], [2, "returned_yn", "VARCHAR(1)", 0, null, 0], [3, "returned_late_yn", "VARCHAR(1)", 0, null, 0], [4, "booked_count", "INTEGER", 0, null, 0], [5, "booked_amount", "FLOAT", 0, null, 0]], "primary_keys": ["booking_id", "product_id"], "foreign_keys": [[0, 0, "Products_for_Hire", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "booking_id", "booking_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "booking_id"], [1, 1, "product_id"]]], "check_constraints": []}, "View_Product_Availability": {"columns": [[0, "product_id", "INTEGER", 1, null, 0], [1, "booking_id", "INTEGER", 1, null, 0], [2, "status_date", "DATETIME", 0, null, 1], [3, "available_yn", "VARCHAR(1)", 0, null, 0]], "primary_keys": ["status_date"], "foreign_keys": [[0, 0, "Products_for_Hire", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Bookings", "booking_id", "booking_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 2, "status_date"]]], "check_constraints": []}} | CREATE TABLE Discount_Coupons (
coupon_id INTEGER PRIMARY KEY,
date_issued DATETIME,
coupon_amount DECIMAL(19,4)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
coupon_id INTEGER NOT NULL,
good_or_bad_customer VARCHAR(4),
first_name VARCHAR(80),
last_name VARCHAR(80),
gender_mf VARCHAR(1),
date_became_customer DATETIME,
date_last_hire DATETIME,
FOREIGN KEY (coupon_id) REFERENCES Discount_Coupons(coupon_id)
);
CREATE TABLE Bookings (
booking_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
booking_status_code VARCHAR(10) NOT NULL,
returned_damaged_yn VARCHAR(40),
booking_start_date DATETIME,
booking_end_date DATETIME,
count_hired VARCHAR(40),
amount_payable DECIMAL(19,4),
amount_of_discount DECIMAL(19,4),
amount_outstanding DECIMAL(19,4),
amount_of_refund DECIMAL(19,4),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Products_for_Hire (
product_id INTEGER PRIMARY KEY,
product_type_code VARCHAR(15) NOT NULL,
daily_hire_cost DECIMAL(19,4),
product_name VARCHAR(80),
product_description VARCHAR(255)
);
CREATE TABLE Payments (
payment_id INTEGER PRIMARY KEY,
booking_id INTEGER,
customer_id INTEGER NOT NULL,
payment_type_code VARCHAR(15) NOT NULL,
amount_paid_in_full_yn VARCHAR(1),
payment_date DATETIME,
amount_due DECIMAL(19,4),
amount_paid DECIMAL(19,4),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (booking_id) REFERENCES Bookings(booking_id)
);
CREATE TABLE Products_Booked (
booking_id INTEGER NOT NULL PRIMARY KEY,
product_id INTEGER NOT NULL PRIMARY KEY,
returned_yn VARCHAR(1),
returned_late_yn VARCHAR(1),
booked_count INTEGER,
booked_amount FLOAT,
PRIMARY KEY (booking_id, product_id),
UNIQUE (booking_id, product_id),
FOREIGN KEY (product_id) REFERENCES Products_for_Hire(product_id),
FOREIGN KEY (booking_id) REFERENCES Bookings(booking_id)
);
CREATE TABLE View_Product_Availability (
product_id INTEGER NOT NULL,
booking_id INTEGER NOT NULL,
status_date DATETIME PRIMARY KEY,
available_yn VARCHAR(1),
UNIQUE (status_date),
FOREIGN KEY (product_id) REFERENCES Products_for_Hire(product_id),
FOREIGN KEY (booking_id) REFERENCES Bookings(booking_id)
); |
concert_singer | {"stadium": {"columns": [[0, "Stadium_ID", "INT", 0, null, 1], [1, "Location", "TEXT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "Capacity", "INT", 0, null, 0], [4, "Highest", "INT", 0, null, 0], [5, "Lowest", "INT", 0, null, 0], [6, "Average", "INT", 0, null, 0]], "primary_keys": ["Stadium_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Stadium_ID"]]], "check_constraints": []}, "singer": {"columns": [[0, "Singer_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Country", "TEXT", 0, null, 0], [3, "Song_Name", "TEXT", 0, null, 0], [4, "Song_release_year", "TEXT", 0, null, 0], [5, "Age", "INT", 0, null, 0], [6, "Is_male", "bool", 0, null, 0]], "primary_keys": ["Singer_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Singer_ID"]]], "check_constraints": []}, "concert": {"columns": [[0, "concert_ID", "INT", 0, null, 1], [1, "concert_Name", "TEXT", 0, null, 0], [2, "Theme", "TEXT", 0, null, 0], [3, "Stadium_ID", "TEXT", 0, null, 0], [4, "Year", "TEXT", 0, null, 0]], "primary_keys": ["concert_ID"], "foreign_keys": [[0, 0, "stadium", "Stadium_ID", "Stadium_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "concert_ID"]]], "check_constraints": []}, "singer_in_concert": {"columns": [[0, "concert_ID", "INT", 0, null, 1], [1, "Singer_ID", "TEXT", 0, null, 2]], "primary_keys": ["concert_ID", "Singer_ID"], "foreign_keys": [[0, 0, "singer", "Singer_ID", "Singer_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "concert", "concert_ID", "concert_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "concert_ID"], [1, 1, "Singer_ID"]]], "check_constraints": []}} | CREATE TABLE stadium (
Stadium_ID INT PRIMARY KEY,
Location TEXT,
Name TEXT,
Capacity INT,
Highest INT,
Lowest INT,
Average INT,
UNIQUE (Stadium_ID)
);
CREATE TABLE singer (
Singer_ID INT PRIMARY KEY,
Name TEXT,
Country TEXT,
Song_Name TEXT,
Song_release_year TEXT,
Age INT,
Is_male bool,
UNIQUE (Singer_ID)
);
CREATE TABLE concert (
concert_ID INT PRIMARY KEY,
concert_Name TEXT,
Theme TEXT,
Stadium_ID TEXT,
Year TEXT,
UNIQUE (concert_ID),
FOREIGN KEY (Stadium_ID) REFERENCES stadium(Stadium_ID)
);
CREATE TABLE singer_in_concert (
concert_ID INT PRIMARY KEY,
Singer_ID TEXT PRIMARY KEY,
PRIMARY KEY (concert_ID, Singer_ID),
UNIQUE (concert_ID, Singer_ID),
FOREIGN KEY (Singer_ID) REFERENCES singer(Singer_ID),
FOREIGN KEY (concert_ID) REFERENCES concert(concert_ID)
); |
body_builder | {"body_builder": {"columns": [[0, "Body_Builder_ID", "INT", 0, null, 1], [1, "People_ID", "INT", 0, null, 0], [2, "Snatch", "REAL", 0, null, 0], [3, "Clean_Jerk", "REAL", 0, null, 0], [4, "Total", "REAL", 0, null, 0]], "primary_keys": ["Body_Builder_ID"], "foreign_keys": [[0, 0, "people", "People_ID", "People_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Body_Builder_ID"]]], "check_constraints": []}, "people": {"columns": [[0, "People_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Height", "REAL", 0, null, 0], [3, "Weight", "REAL", 0, null, 0], [4, "Birth_Date", "TEXT", 0, null, 0], [5, "Birth_Place", "TEXT", 0, null, 0]], "primary_keys": ["People_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "People_ID"]]], "check_constraints": []}} | CREATE TABLE body_builder (
Body_Builder_ID INT PRIMARY KEY,
People_ID INT,
Snatch REAL,
Clean_Jerk REAL,
Total REAL,
UNIQUE (Body_Builder_ID),
FOREIGN KEY (People_ID) REFERENCES people(People_ID)
);
CREATE TABLE people (
People_ID INT PRIMARY KEY,
Name TEXT,
Height REAL,
Weight REAL,
Birth_Date TEXT,
Birth_Place TEXT,
UNIQUE (People_ID)
); |
race_track | {"race": {"columns": [[0, "Race_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Class", "TEXT", 0, null, 0], [3, "Date", "TEXT", 0, null, 0], [4, "Track_ID", "TEXT", 0, null, 0]], "primary_keys": ["Race_ID"], "foreign_keys": [[0, 0, "track", "Track_ID", "Track_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Race_ID"]]], "check_constraints": []}, "track": {"columns": [[0, "Track_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Seating", "REAL", 0, null, 0], [4, "Year_Opened", "REAL", 0, null, 0]], "primary_keys": ["Track_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Track_ID"]]], "check_constraints": []}} | CREATE TABLE race (
Race_ID INT PRIMARY KEY,
Name TEXT,
Class TEXT,
Date TEXT,
Track_ID TEXT,
UNIQUE (Race_ID),
FOREIGN KEY (Track_ID) REFERENCES track(Track_ID)
);
CREATE TABLE track (
Track_ID INT PRIMARY KEY,
Name TEXT,
Location TEXT,
Seating REAL,
Year_Opened REAL,
UNIQUE (Track_ID)
); |
club_1 | {"Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Club": {"columns": [[0, "ClubID", "INTEGER", 0, null, 1], [1, "ClubName", "VARCHAR(40)", 0, null, 0], [2, "ClubDesc", "VARCHAR(1024)", 0, null, 0], [3, "ClubLocation", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["ClubID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Member_of_club": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "ClubID", "INTEGER", 0, null, 0], [2, "Position", "VARCHAR(40)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Club", "ClubID", "ClubID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "StuID", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
);
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY (ClubID) REFERENCES Club(ClubID),
FOREIGN KEY (StuID) REFERENCES Student(StuID)
); |
local_govt_mdm | {"Customer_Master_Index": {"columns": [[0, "master_customer_id", "INTEGER", 1, null, 1], [1, "cmi_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["master_customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "CMI_Cross_References": {"columns": [[0, "cmi_cross_ref_id", "INTEGER", 1, null, 1], [1, "master_customer_id", "INTEGER", 1, null, 0], [2, "source_system_code", "CHAR(15)", 1, null, 0]], "primary_keys": ["cmi_cross_ref_id"], "foreign_keys": [[0, 0, "Customer_Master_Index", "master_customer_id", "master_customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Council_Tax": {"columns": [[0, "council_tax_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["council_tax_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Business_Rates": {"columns": [[0, "business_rates_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["business_rates_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Benefits_Overpayments": {"columns": [[0, "council_tax_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["council_tax_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Parking_Fines": {"columns": [[0, "council_tax_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["council_tax_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Rent_Arrears": {"columns": [[0, "council_tax_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["council_tax_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Electoral_Register": {"columns": [[0, "electoral_register_id", "INTEGER", 1, null, 1], [1, "cmi_cross_ref_id", "INTEGER", 1, null, 0]], "primary_keys": ["electoral_register_id"], "foreign_keys": [[0, 0, "CMI_Cross_References", "cmi_cross_ref_id", "cmi_cross_ref_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Customer_Master_Index (
master_customer_id INTEGER NOT NULL PRIMARY KEY,
cmi_details VARCHAR(255)
);
CREATE TABLE CMI_Cross_References (
cmi_cross_ref_id INTEGER NOT NULL PRIMARY KEY,
master_customer_id INTEGER NOT NULL,
source_system_code CHAR(15) NOT NULL,
FOREIGN KEY (master_customer_id) REFERENCES Customer_Master_Index(master_customer_id)
);
CREATE TABLE Council_Tax (
council_tax_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
);
CREATE TABLE Business_Rates (
business_rates_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
);
CREATE TABLE Benefits_Overpayments (
council_tax_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
);
CREATE TABLE Parking_Fines (
council_tax_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
);
CREATE TABLE Rent_Arrears (
council_tax_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
);
CREATE TABLE Electoral_Register (
electoral_register_id INTEGER NOT NULL PRIMARY KEY,
cmi_cross_ref_id INTEGER NOT NULL,
FOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References(cmi_cross_ref_id)
); |
journal_committee | {"journal": {"columns": [[0, "Journal_ID", "INT", 0, null, 1], [1, "Date", "TEXT", 0, null, 0], [2, "Theme", "TEXT", 0, null, 0], [3, "Sales", "INT", 0, null, 0]], "primary_keys": ["Journal_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Journal_ID"]]], "check_constraints": []}, "editor": {"columns": [[0, "Editor_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Age", "REAL", 0, null, 0]], "primary_keys": ["Editor_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Editor_ID"]]], "check_constraints": []}, "journal_committee": {"columns": [[0, "Editor_ID", "INT", 0, null, 1], [1, "Journal_ID", "INT", 0, null, 2], [2, "Work_Type", "TEXT", 0, null, 0]], "primary_keys": ["Editor_ID", "Journal_ID"], "foreign_keys": [[0, 0, "journal", "Journal_ID", "Journal_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "editor", "Editor_ID", "Editor_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Editor_ID"], [1, 1, "Journal_ID"]]], "check_constraints": []}} | CREATE TABLE journal (
Journal_ID INT PRIMARY KEY,
Date TEXT,
Theme TEXT,
Sales INT,
UNIQUE (Journal_ID)
);
CREATE TABLE editor (
Editor_ID INT PRIMARY KEY,
Name TEXT,
Age REAL,
UNIQUE (Editor_ID)
);
CREATE TABLE journal_committee (
Editor_ID INT PRIMARY KEY,
Journal_ID INT PRIMARY KEY,
Work_Type TEXT,
PRIMARY KEY (Editor_ID, Journal_ID),
UNIQUE (Editor_ID, Journal_ID),
FOREIGN KEY (Journal_ID) REFERENCES journal(Journal_ID),
FOREIGN KEY (Editor_ID) REFERENCES editor(Editor_ID)
); |
movie_1 | {"Movie": {"columns": [[0, "mID", "INT", 0, null, 1], [1, "title", "TEXT", 0, null, 0], [2, "year", "INT", 0, null, 0], [3, "director", "TEXT", 0, null, 0]], "primary_keys": ["mID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "mID"]]], "check_constraints": []}, "Reviewer": {"columns": [[0, "rID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0]], "primary_keys": ["rID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "rID"]]], "check_constraints": []}, "Rating": {"columns": [[0, "rID", "INT", 0, null, 0], [1, "mID", "INT", 0, null, 0], [2, "stars", "INT", 0, null, 0], [3, "ratingDate", "date", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Reviewer", "rID", "rID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Movie", "mID", "mID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Movie (
mID INT PRIMARY KEY,
title TEXT,
year INT,
director TEXT,
UNIQUE (mID)
);
CREATE TABLE Reviewer (
rID INT PRIMARY KEY,
name TEXT,
UNIQUE (rID)
);
CREATE TABLE Rating (
rID INT,
mID INT,
stars INT,
ratingDate date,
FOREIGN KEY (rID) REFERENCES Reviewer(rID),
FOREIGN KEY (mID) REFERENCES Movie(mID)
); |
culture_company | {"book_club": {"columns": [[0, "book_club_id", "INT", 0, null, 1], [1, "Year", "INT", 0, null, 0], [2, "Author_or_Editor", "TEXT", 0, null, 0], [3, "Book_Title", "TEXT", 0, null, 0], [4, "Publisher", "TEXT", 0, null, 0], [5, "Category", "TEXT", 0, null, 0], [6, "Result", "TEXT", 0, null, 0]], "primary_keys": ["book_club_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "book_club_id"]]], "check_constraints": []}, "movie": {"columns": [[0, "movie_id", "INT", 0, null, 1], [1, "Title", "TEXT", 0, null, 0], [2, "Year", "INT", 0, null, 0], [3, "Director", "TEXT", 0, null, 0], [4, "Budget_million", "REAL", 0, null, 0], [5, "Gross_worldwide", "INT", 0, null, 0]], "primary_keys": ["movie_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "movie_id"]]], "check_constraints": []}, "culture_company": {"columns": [[0, "Company_name", "TEXT", 0, null, 1], [1, "Type", "TEXT", 0, null, 0], [2, "Incorporated_in", "TEXT", 0, null, 0], [3, "Group_Equity_Shareholding", "REAL", 0, null, 0], [4, "book_club_id", "TEXT", 0, null, 0], [5, "movie_id", "TEXT", 0, null, 0]], "primary_keys": ["Company_name"], "foreign_keys": [[0, 0, "movie", "movie_id", "movie_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "book_club", "book_club_id", "book_club_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Company_name"]]], "check_constraints": []}} | CREATE TABLE book_club (
book_club_id INT PRIMARY KEY,
Year INT,
Author_or_Editor TEXT,
Book_Title TEXT,
Publisher TEXT,
Category TEXT,
Result TEXT,
UNIQUE (book_club_id)
);
CREATE TABLE movie (
movie_id INT PRIMARY KEY,
Title TEXT,
Year INT,
Director TEXT,
Budget_million REAL,
Gross_worldwide INT,
UNIQUE (movie_id)
);
CREATE TABLE culture_company (
Company_name TEXT PRIMARY KEY,
Type TEXT,
Incorporated_in TEXT,
Group_Equity_Shareholding REAL,
book_club_id TEXT,
movie_id TEXT,
UNIQUE (Company_name),
FOREIGN KEY (movie_id) REFERENCES movie(movie_id),
FOREIGN KEY (book_club_id) REFERENCES book_club(book_club_id)
); |
baseball_1 | {"all_star": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "game_num", "INTEGER", 0, null, 0], [3, "game_id", "TEXT", 0, null, 0], [4, "team_id", "TEXT", 0, null, 0], [5, "league_id", "TEXT", 0, null, 0], [6, "gp", "NUMERIC", 0, null, 0], [7, "starting_pos", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "appearances": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "team_id", "TEXT", 0, null, 0], [2, "league_id", "TEXT", 0, null, 0], [3, "player_id", "TEXT", 0, null, 0], [4, "g_all", "NUMERIC", 0, null, 0], [5, "gs", "NUMERIC", 0, null, 0], [6, "g_batting", "INTEGER", 0, null, 0], [7, "g_defense", "NUMERIC", 0, null, 0], [8, "g_p", "INTEGER", 0, null, 0], [9, "g_c", "INTEGER", 0, null, 0], [10, "g_1b", "INTEGER", 0, null, 0], [11, "g_2b", "INTEGER", 0, null, 0], [12, "g_3b", "INTEGER", 0, null, 0], [13, "g_ss", "INTEGER", 0, null, 0], [14, "g_lf", "INTEGER", 0, null, 0], [15, "g_cf", "INTEGER", 0, null, 0], [16, "g_rf", "INTEGER", 0, null, 0], [17, "g_of", "INTEGER", 0, null, 0], [18, "g_dh", "NUMERIC", 0, null, 0], [19, "g_ph", "NUMERIC", 0, null, 0], [20, "g_pr", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "team", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "manager_award": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "award_id", "TEXT", 0, null, 0], [2, "year", "INTEGER", 0, null, 0], [3, "league_id", "TEXT", 0, null, 0], [4, "tie", "TEXT", 0, null, 0], [5, "notes", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "player_award": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "award_id", "TEXT", 0, null, 0], [2, "year", "INTEGER", 0, null, 0], [3, "league_id", "TEXT", 0, null, 0], [4, "tie", "TEXT", 0, null, 0], [5, "notes", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "manager_award_vote": {"columns": [[0, "award_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "league_id", "TEXT", 0, null, 0], [3, "player_id", "TEXT", 0, null, 0], [4, "points_won", "INTEGER", 0, null, 0], [5, "points_max", "INTEGER", 0, null, 0], [6, "votes_first", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "player_award_vote": {"columns": [[0, "award_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "league_id", "TEXT", 0, null, 0], [3, "player_id", "TEXT", 0, null, 0], [4, "points_won", "NUMERIC", 0, null, 0], [5, "points_max", "INTEGER", 0, null, 0], [6, "votes_first", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "batting": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "stint", "INTEGER", 0, null, 0], [3, "team_id", "TEXT", 0, null, 0], [4, "league_id", "TEXT", 0, null, 0], [5, "g", "INTEGER", 0, null, 0], [6, "ab", "NUMERIC", 0, null, 0], [7, "r", "NUMERIC", 0, null, 0], [8, "h", "NUMERIC", 0, null, 0], [9, "double", "NUMERIC", 0, null, 0], [10, "triple", "NUMERIC", 0, null, 0], [11, "hr", "NUMERIC", 0, null, 0], [12, "rbi", "NUMERIC", 0, null, 0], [13, "sb", "NUMERIC", 0, null, 0], [14, "cs", "NUMERIC", 0, null, 0], [15, "bb", "NUMERIC", 0, null, 0], [16, "so", "NUMERIC", 0, null, 0], [17, "ibb", "NUMERIC", 0, null, 0], [18, "hbp", "NUMERIC", 0, null, 0], [19, "sh", "NUMERIC", 0, null, 0], [20, "sf", "NUMERIC", 0, null, 0], [21, "g_idp", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "batting_postseason": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "round", "TEXT", 0, null, 0], [2, "player_id", "TEXT", 0, null, 0], [3, "team_id", "TEXT", 0, null, 0], [4, "league_id", "TEXT", 0, null, 0], [5, "g", "INTEGER", 0, null, 0], [6, "ab", "INTEGER", 0, null, 0], [7, "r", "INTEGER", 0, null, 0], [8, "h", "INTEGER", 0, null, 0], [9, "double", "INTEGER", 0, null, 0], [10, "triple", "INTEGER", 0, null, 0], [11, "hr", "INTEGER", 0, null, 0], [12, "rbi", "INTEGER", 0, null, 0], [13, "sb", "INTEGER", 0, null, 0], [14, "cs", "NUMERIC", 0, null, 0], [15, "bb", "INTEGER", 0, null, 0], [16, "so", "INTEGER", 0, null, 0], [17, "ibb", "NUMERIC", 0, null, 0], [18, "hbp", "NUMERIC", 0, null, 0], [19, "sh", "NUMERIC", 0, null, 0], [20, "sf", "NUMERIC", 0, null, 0], [21, "g_idp", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "team", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "player_college": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "college_id", "TEXT", 0, null, 0], [2, "year", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "college", "college_id", "college_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "fielding": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "stint", "INTEGER", 0, null, 0], [3, "team_id", "TEXT", 0, null, 0], [4, "league_id", "TEXT", 0, null, 0], [5, "pos", "TEXT", 0, null, 0], [6, "g", "INTEGER", 0, null, 0], [7, "gs", "NUMERIC", 0, null, 0], [8, "inn_outs", "NUMERIC", 0, null, 0], [9, "po", "NUMERIC", 0, null, 0], [10, "a", "NUMERIC", 0, null, 0], [11, "e", "NUMERIC", 0, null, 0], [12, "dp", "NUMERIC", 0, null, 0], [13, "pb", "NUMERIC", 0, null, 0], [14, "wp", "NUMERIC", 0, null, 0], [15, "sb", "NUMERIC", 0, null, 0], [16, "cs", "NUMERIC", 0, null, 0], [17, "zr", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "fielding_outfield": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "stint", "INTEGER", 0, null, 0], [3, "glf", "NUMERIC", 0, null, 0], [4, "gcf", "NUMERIC", 0, null, 0], [5, "grf", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "fielding_postseason": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "league_id", "TEXT", 0, null, 0], [4, "round", "TEXT", 0, null, 0], [5, "pos", "TEXT", 0, null, 0], [6, "g", "INTEGER", 0, null, 0], [7, "gs", "NUMERIC", 0, null, 0], [8, "inn_outs", "NUMERIC", 0, null, 0], [9, "po", "INTEGER", 0, null, 0], [10, "a", "INTEGER", 0, null, 0], [11, "e", "INTEGER", 0, null, 0], [12, "dp", "INTEGER", 0, null, 0], [13, "tp", "INTEGER", 0, null, 0], [14, "pb", "NUMERIC", 0, null, 0], [15, "sb", "NUMERIC", 0, null, 0], [16, "cs", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "hall_of_fame": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "yearid", "INTEGER", 0, null, 0], [2, "votedby", "TEXT", 0, null, 0], [3, "ballots", "NUMERIC", 0, null, 0], [4, "needed", "NUMERIC", 0, null, 0], [5, "votes", "NUMERIC", 0, null, 0], [6, "inducted", "TEXT", 0, null, 0], [7, "category", "TEXT", 0, null, 0], [8, "needed_note", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "player", "player_id", "player_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "home_game": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "league_id", "TEXT", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "park_id", "TEXT", 0, null, 0], [4, "span_first", "TEXT", 0, null, 0], [5, "span_last", "TEXT", 0, null, 0], [6, "games", "INTEGER", 0, null, 0], [7, "openings", "INTEGER", 0, null, 0], [8, "attendance", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "park", "park_id", "park_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "team", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "manager": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "league_id", "TEXT", 0, null, 0], [4, "inseason", "INTEGER", 0, null, 0], [5, "g", "INTEGER", 0, null, 0], [6, "w", "INTEGER", 0, null, 0], [7, "l", "INTEGER", 0, null, 0], [8, "rank", "NUMERIC", 0, null, 0], [9, "plyr_mgr", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "team", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "manager_half": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "league_id", "TEXT", 0, null, 0], [4, "inseason", "INTEGER", 0, null, 0], [5, "half", "INTEGER", 0, null, 0], [6, "g", "INTEGER", 0, null, 0], [7, "w", "INTEGER", 0, null, 0], [8, "l", "INTEGER", 0, null, 0], [9, "rank", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "team", "team_id", "team_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "player": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "birth_year", "NUMERIC", 0, null, 0], [2, "birth_month", "NUMERIC", 0, null, 0], [3, "birth_day", "NUMERIC", 0, null, 0], [4, "birth_country", "TEXT", 0, null, 0], [5, "birth_state", "TEXT", 0, null, 0], [6, "birth_city", "TEXT", 0, null, 0], [7, "death_year", "NUMERIC", 0, null, 0], [8, "death_month", "NUMERIC", 0, null, 0], [9, "death_day", "NUMERIC", 0, null, 0], [10, "death_country", "TEXT", 0, null, 0], [11, "death_state", "TEXT", 0, null, 0], [12, "death_city", "TEXT", 0, null, 0], [13, "name_first", "TEXT", 0, null, 0], [14, "name_last", "TEXT", 0, null, 0], [15, "name_given", "TEXT", 0, null, 0], [16, "weight", "NUMERIC", 0, null, 0], [17, "height", "NUMERIC", 0, null, 0], [18, "bats", "TEXT", 0, null, 0], [19, "throws", "TEXT", 0, null, 0], [20, "debut", "TEXT", 0, null, 0], [21, "final_game", "TEXT", 0, null, 0], [22, "retro_id", "TEXT", 0, null, 0], [23, "bbref_id", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "park": {"columns": [[0, "park_id", "TEXT", 0, null, 0], [1, "park_name", "TEXT", 0, null, 0], [2, "park_alias", "TEXT", 0, null, 0], [3, "city", "TEXT", 0, null, 0], [4, "state", "TEXT", 0, null, 0], [5, "country", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "pitching": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "stint", "INTEGER", 0, null, 0], [3, "team_id", "TEXT", 0, null, 0], [4, "league_id", "TEXT", 0, null, 0], [5, "w", "INTEGER", 0, null, 0], [6, "l", "INTEGER", 0, null, 0], [7, "g", "INTEGER", 0, null, 0], [8, "gs", "INTEGER", 0, null, 0], [9, "cg", "INTEGER", 0, null, 0], [10, "sho", "INTEGER", 0, null, 0], [11, "sv", "INTEGER", 0, null, 0], [12, "ipouts", "NUMERIC", 0, null, 0], [13, "h", "INTEGER", 0, null, 0], [14, "er", "INTEGER", 0, null, 0], [15, "hr", "INTEGER", 0, null, 0], [16, "bb", "INTEGER", 0, null, 0], [17, "so", "INTEGER", 0, null, 0], [18, "baopp", "NUMERIC", 0, null, 0], [19, "era", "NUMERIC", 0, null, 0], [20, "ibb", "NUMERIC", 0, null, 0], [21, "wp", "NUMERIC", 0, null, 0], [22, "hbp", "NUMERIC", 0, null, 0], [23, "bk", "INTEGER", 0, null, 0], [24, "bfp", "NUMERIC", 0, null, 0], [25, "gf", "NUMERIC", 0, null, 0], [26, "r", "INTEGER", 0, null, 0], [27, "sh", "NUMERIC", 0, null, 0], [28, "sf", "NUMERIC", 0, null, 0], [29, "g_idp", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "pitching_postseason": {"columns": [[0, "player_id", "TEXT", 0, null, 0], [1, "year", "INTEGER", 0, null, 0], [2, "round", "TEXT", 0, null, 0], [3, "team_id", "TEXT", 0, null, 0], [4, "league_id", "TEXT", 0, null, 0], [5, "w", "INTEGER", 0, null, 0], [6, "l", "INTEGER", 0, null, 0], [7, "g", "INTEGER", 0, null, 0], [8, "gs", "INTEGER", 0, null, 0], [9, "cg", "INTEGER", 0, null, 0], [10, "sho", "INTEGER", 0, null, 0], [11, "sv", "INTEGER", 0, null, 0], [12, "ipouts", "INTEGER", 0, null, 0], [13, "h", "INTEGER", 0, null, 0], [14, "er", "INTEGER", 0, null, 0], [15, "hr", "INTEGER", 0, null, 0], [16, "bb", "INTEGER", 0, null, 0], [17, "so", "INTEGER", 0, null, 0], [18, "baopp", "TEXT", 0, null, 0], [19, "era", "NUMERIC", 0, null, 0], [20, "ibb", "NUMERIC", 0, null, 0], [21, "wp", "NUMERIC", 0, null, 0], [22, "hbp", "NUMERIC", 0, null, 0], [23, "bk", "NUMERIC", 0, null, 0], [24, "bfp", "NUMERIC", 0, null, 0], [25, "gf", "INTEGER", 0, null, 0], [26, "r", "INTEGER", 0, null, 0], [27, "sh", "NUMERIC", 0, null, 0], [28, "sf", "NUMERIC", 0, null, 0], [29, "g_idp", "NUMERIC", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "salary": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "team_id", "TEXT", 0, null, 0], [2, "league_id", "TEXT", 0, null, 0], [3, "player_id", "TEXT", 0, null, 0], [4, "salary", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "college": {"columns": [[0, "college_id", "TEXT", 0, null, 0], [1, "name_full", "TEXT", 0, null, 0], [2, "city", "TEXT", 0, null, 0], [3, "state", "TEXT", 0, null, 0], [4, "country", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "postseason": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "round", "TEXT", 0, null, 0], [2, "team_id_winner", "TEXT", 0, null, 0], [3, "league_id_winner", "TEXT", 0, null, 0], [4, "team_id_loser", "TEXT", 0, null, 0], [5, "league_id_loser", "TEXT", 0, null, 0], [6, "wins", "INTEGER", 0, null, 0], [7, "losses", "INTEGER", 0, null, 0], [8, "ties", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "team": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "league_id", "TEXT", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "franchise_id", "TEXT", 0, null, 0], [4, "div_id", "TEXT", 0, null, 0], [5, "rank", "INTEGER", 0, null, 0], [6, "g", "INTEGER", 0, null, 0], [7, "ghome", "NUMERIC", 0, null, 0], [8, "w", "INTEGER", 0, null, 0], [9, "l", "INTEGER", 0, null, 0], [10, "div_win", "TEXT", 0, null, 0], [11, "wc_win", "TEXT", 0, null, 0], [12, "lg_win", "TEXT", 0, null, 0], [13, "ws_win", "TEXT", 0, null, 0], [14, "r", "INTEGER", 0, null, 0], [15, "ab", "INTEGER", 0, null, 0], [16, "h", "INTEGER", 0, null, 0], [17, "double", "INTEGER", 0, null, 0], [18, "triple", "INTEGER", 0, null, 0], [19, "hr", "INTEGER", 0, null, 0], [20, "bb", "INTEGER", 0, null, 0], [21, "so", "NUMERIC", 0, null, 0], [22, "sb", "NUMERIC", 0, null, 0], [23, "cs", "NUMERIC", 0, null, 0], [24, "hbp", "NUMERIC", 0, null, 0], [25, "sf", "NUMERIC", 0, null, 0], [26, "ra", "INTEGER", 0, null, 0], [27, "er", "INTEGER", 0, null, 0], [28, "era", "NUMERIC", 0, null, 0], [29, "cg", "INTEGER", 0, null, 0], [30, "sho", "INTEGER", 0, null, 0], [31, "sv", "INTEGER", 0, null, 0], [32, "ipouts", "INTEGER", 0, null, 0], [33, "ha", "INTEGER", 0, null, 0], [34, "hra", "INTEGER", 0, null, 0], [35, "bba", "INTEGER", 0, null, 0], [36, "soa", "INTEGER", 0, null, 0], [37, "e", "INTEGER", 0, null, 0], [38, "dp", "NUMERIC", 0, null, 0], [39, "fp", "NUMERIC", 0, null, 0], [40, "name", "TEXT", 0, null, 0], [41, "park", "TEXT", 0, null, 0], [42, "attendance", "NUMERIC", 0, null, 0], [43, "bpf", "INTEGER", 0, null, 0], [44, "ppf", "INTEGER", 0, null, 0], [45, "team_id_br", "TEXT", 0, null, 0], [46, "team_id_lahman45", "TEXT", 0, null, 0], [47, "team_id_retro", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "team_franchise": {"columns": [[0, "franchise_id", "TEXT", 0, null, 0], [1, "franchise_name", "TEXT", 0, null, 0], [2, "active", "TEXT", 0, null, 0], [3, "na_assoc", "TEXT", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "team_half": {"columns": [[0, "year", "INTEGER", 0, null, 0], [1, "league_id", "TEXT", 0, null, 0], [2, "team_id", "TEXT", 0, null, 0], [3, "half", "INTEGER", 0, null, 0], [4, "div_id", "TEXT", 0, null, 0], [5, "div_win", "TEXT", 0, null, 0], [6, "rank", "INTEGER", 0, null, 0], [7, "g", "INTEGER", 0, null, 0], [8, "w", "INTEGER", 0, null, 0], [9, "l", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE all_star (
player_id TEXT,
year INTEGER,
game_num INTEGER,
game_id TEXT,
team_id TEXT,
league_id TEXT,
gp NUMERIC,
starting_pos NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE appearances (
year INTEGER,
team_id TEXT,
league_id TEXT,
player_id TEXT,
g_all NUMERIC,
gs NUMERIC,
g_batting INTEGER,
g_defense NUMERIC,
g_p INTEGER,
g_c INTEGER,
g_1b INTEGER,
g_2b INTEGER,
g_3b INTEGER,
g_ss INTEGER,
g_lf INTEGER,
g_cf INTEGER,
g_rf INTEGER,
g_of INTEGER,
g_dh NUMERIC,
g_ph NUMERIC,
g_pr NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id),
FOREIGN KEY (team_id) REFERENCES team(team_id)
);
CREATE TABLE manager_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE player_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes TEXT,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE manager_award_vote (
award_id TEXT,
year INTEGER,
league_id TEXT,
player_id TEXT,
points_won INTEGER,
points_max INTEGER,
votes_first INTEGER
);
CREATE TABLE player_award_vote (
award_id TEXT,
year INTEGER,
league_id TEXT,
player_id TEXT,
points_won NUMERIC,
points_max INTEGER,
votes_first NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE batting (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
g INTEGER,
ab NUMERIC,
r NUMERIC,
h NUMERIC,
double NUMERIC,
triple NUMERIC,
hr NUMERIC,
rbi NUMERIC,
sb NUMERIC,
cs NUMERIC,
bb NUMERIC,
so NUMERIC,
ibb NUMERIC,
hbp NUMERIC,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE batting_postseason (
year INTEGER,
round TEXT,
player_id TEXT,
team_id TEXT,
league_id TEXT,
g INTEGER,
ab INTEGER,
r INTEGER,
h INTEGER,
double INTEGER,
triple INTEGER,
hr INTEGER,
rbi INTEGER,
sb INTEGER,
cs NUMERIC,
bb INTEGER,
so INTEGER,
ibb NUMERIC,
hbp NUMERIC,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC,
FOREIGN KEY (team_id) REFERENCES team(team_id),
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE player_college (
player_id TEXT,
college_id TEXT,
year INTEGER,
FOREIGN KEY (college_id) REFERENCES college(college_id),
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE fielding (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
pos TEXT,
g INTEGER,
gs NUMERIC,
inn_outs NUMERIC,
po NUMERIC,
a NUMERIC,
e NUMERIC,
dp NUMERIC,
pb NUMERIC,
wp NUMERIC,
sb NUMERIC,
cs NUMERIC,
zr NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE fielding_outfield (
player_id TEXT,
year INTEGER,
stint INTEGER,
glf NUMERIC,
gcf NUMERIC,
grf NUMERIC,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE fielding_postseason (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
round TEXT,
pos TEXT,
g INTEGER,
gs NUMERIC,
inn_outs NUMERIC,
po INTEGER,
a INTEGER,
e INTEGER,
dp INTEGER,
tp INTEGER,
pb NUMERIC,
sb NUMERIC,
cs NUMERIC,
FOREIGN KEY (team_id) REFERENCES player(team_id),
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE hall_of_fame (
player_id TEXT,
yearid INTEGER,
votedby TEXT,
ballots NUMERIC,
needed NUMERIC,
votes NUMERIC,
inducted TEXT,
category TEXT,
needed_note TEXT,
FOREIGN KEY (player_id) REFERENCES player(player_id)
);
CREATE TABLE home_game (
year INTEGER,
league_id TEXT,
team_id TEXT,
park_id TEXT,
span_first TEXT,
span_last TEXT,
games INTEGER,
openings INTEGER,
attendance INTEGER,
FOREIGN KEY (park_id) REFERENCES park(park_id),
FOREIGN KEY (team_id) REFERENCES team(team_id)
);
CREATE TABLE manager (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
inseason INTEGER,
g INTEGER,
w INTEGER,
l INTEGER,
rank NUMERIC,
plyr_mgr TEXT,
FOREIGN KEY (team_id) REFERENCES team(team_id)
);
CREATE TABLE manager_half (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
inseason INTEGER,
half INTEGER,
g INTEGER,
w INTEGER,
l INTEGER,
rank INTEGER,
FOREIGN KEY (team_id) REFERENCES team(team_id)
);
CREATE TABLE player (
player_id TEXT,
birth_year NUMERIC,
birth_month NUMERIC,
birth_day NUMERIC,
birth_country TEXT,
birth_state TEXT,
birth_city TEXT,
death_year NUMERIC,
death_month NUMERIC,
death_day NUMERIC,
death_country TEXT,
death_state TEXT,
death_city TEXT,
name_first TEXT,
name_last TEXT,
name_given TEXT,
weight NUMERIC,
height NUMERIC,
bats TEXT,
throws TEXT,
debut TEXT,
final_game TEXT,
retro_id TEXT,
bbref_id TEXT
);
CREATE TABLE park (
park_id TEXT,
park_name TEXT,
park_alias TEXT,
city TEXT,
state TEXT,
country TEXT
);
CREATE TABLE pitching (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
w INTEGER,
l INTEGER,
g INTEGER,
gs INTEGER,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts NUMERIC,
h INTEGER,
er INTEGER,
hr INTEGER,
bb INTEGER,
so INTEGER,
baopp NUMERIC,
era NUMERIC,
ibb NUMERIC,
wp NUMERIC,
hbp NUMERIC,
bk INTEGER,
bfp NUMERIC,
gf NUMERIC,
r INTEGER,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
);
CREATE TABLE pitching_postseason (
player_id TEXT,
year INTEGER,
round TEXT,
team_id TEXT,
league_id TEXT,
w INTEGER,
l INTEGER,
g INTEGER,
gs INTEGER,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts INTEGER,
h INTEGER,
er INTEGER,
hr INTEGER,
bb INTEGER,
so INTEGER,
baopp TEXT,
era NUMERIC,
ibb NUMERIC,
wp NUMERIC,
hbp NUMERIC,
bk NUMERIC,
bfp NUMERIC,
gf INTEGER,
r INTEGER,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
);
CREATE TABLE salary (
year INTEGER,
team_id TEXT,
league_id TEXT,
player_id TEXT,
salary INTEGER
);
CREATE TABLE college (
college_id TEXT,
name_full TEXT,
city TEXT,
state TEXT,
country TEXT
);
CREATE TABLE postseason (
year INTEGER,
round TEXT,
team_id_winner TEXT,
league_id_winner TEXT,
team_id_loser TEXT,
league_id_loser TEXT,
wins INTEGER,
losses INTEGER,
ties INTEGER
);
CREATE TABLE team (
year INTEGER,
league_id TEXT,
team_id TEXT,
franchise_id TEXT,
div_id TEXT,
rank INTEGER,
g INTEGER,
ghome NUMERIC,
w INTEGER,
l INTEGER,
div_win TEXT,
wc_win TEXT,
lg_win TEXT,
ws_win TEXT,
r INTEGER,
ab INTEGER,
h INTEGER,
double INTEGER,
triple INTEGER,
hr INTEGER,
bb INTEGER,
so NUMERIC,
sb NUMERIC,
cs NUMERIC,
hbp NUMERIC,
sf NUMERIC,
ra INTEGER,
er INTEGER,
era NUMERIC,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts INTEGER,
ha INTEGER,
hra INTEGER,
bba INTEGER,
soa INTEGER,
e INTEGER,
dp NUMERIC,
fp NUMERIC,
name TEXT,
park TEXT,
attendance NUMERIC,
bpf INTEGER,
ppf INTEGER,
team_id_br TEXT,
team_id_lahman45 TEXT,
team_id_retro TEXT
);
CREATE TABLE team_franchise (
franchise_id TEXT,
franchise_name TEXT,
active TEXT,
na_assoc TEXT
);
CREATE TABLE team_half (
year INTEGER,
league_id TEXT,
team_id TEXT,
half INTEGER,
div_id TEXT,
div_win TEXT,
rank INTEGER,
g INTEGER,
w INTEGER,
l INTEGER
); |
company_employee | {"people": {"columns": [[0, "People_ID", "INT", 0, null, 1], [1, "Age", "INT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "Nationality", "TEXT", 0, null, 0], [4, "Graduation_College", "TEXT", 0, null, 0]], "primary_keys": ["People_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "People_ID"]]], "check_constraints": []}, "company": {"columns": [[0, "Company_ID", "REAL", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Headquarters", "TEXT", 0, null, 0], [3, "Industry", "TEXT", 0, null, 0], [4, "Sales_in_Billion", "REAL", 0, null, 0], [5, "Profits_in_Billion", "REAL", 0, null, 0], [6, "Assets_in_Billion", "REAL", 0, null, 0], [7, "Market_Value_in_Billion", "REAL", 0, null, 0]], "primary_keys": ["Company_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Company_ID"]]], "check_constraints": []}, "employment": {"columns": [[0, "Company_ID", "INT", 0, null, 1], [1, "People_ID", "INT", 0, null, 2], [2, "Year_working", "INT", 0, null, 0]], "primary_keys": ["Company_ID", "People_ID"], "foreign_keys": [[0, 0, "people", "People_ID", "People_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "company", "Company_ID", "Company_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Company_ID"], [1, 1, "People_ID"]]], "check_constraints": []}} | CREATE TABLE people (
People_ID INT PRIMARY KEY,
Age INT,
Name TEXT,
Nationality TEXT,
Graduation_College TEXT,
UNIQUE (People_ID)
);
CREATE TABLE company (
Company_ID REAL PRIMARY KEY,
Name TEXT,
Headquarters TEXT,
Industry TEXT,
Sales_in_Billion REAL,
Profits_in_Billion REAL,
Assets_in_Billion REAL,
Market_Value_in_Billion REAL,
UNIQUE (Company_ID)
);
CREATE TABLE employment (
Company_ID INT PRIMARY KEY,
People_ID INT PRIMARY KEY,
Year_working INT,
PRIMARY KEY (Company_ID, People_ID),
UNIQUE (Company_ID, People_ID),
FOREIGN KEY (People_ID) REFERENCES people(People_ID),
FOREIGN KEY (Company_ID) REFERENCES company(Company_ID)
); |
activity_1 | {"Activity": {"columns": [[0, "actid", "INTEGER", 0, null, 1], [1, "activity_name", "varchar(25)", 0, null, 0]], "primary_keys": ["actid"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Participates_in": {"columns": [[0, "stuid", "INTEGER", 0, null, 0], [1, "actid", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Activity", "actid", "actid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "stuid", "StuID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Faculty_Participates_in": {"columns": [[0, "FacID", "INTEGER", 0, null, 0], [1, "actid", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Activity", "actid", "actid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Faculty", "FacID", "FacID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student": {"columns": [[0, "StuID", "INTEGER", 0, null, 1], [1, "LName", "VARCHAR(12)", 0, null, 0], [2, "Fname", "VARCHAR(12)", 0, null, 0], [3, "Age", "INTEGER", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Major", "INTEGER", 0, null, 0], [6, "Advisor", "INTEGER", 0, null, 0], [7, "city_code", "VARCHAR(3)", 0, null, 0]], "primary_keys": ["StuID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Faculty": {"columns": [[0, "FacID", "INTEGER", 0, null, 1], [1, "Lname", "VARCHAR(15)", 0, null, 0], [2, "Fname", "VARCHAR(15)", 0, null, 0], [3, "Rank", "VARCHAR(15)", 0, null, 0], [4, "Sex", "VARCHAR(1)", 0, null, 0], [5, "Phone", "INTEGER", 0, null, 0], [6, "Room", "VARCHAR(5)", 0, null, 0], [7, "Building", "VARCHAR(13)", 0, null, 0]], "primary_keys": ["FacID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Activity (
actid INTEGER PRIMARY KEY,
activity_name varchar(25)
);
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER,
FOREIGN KEY (actid) REFERENCES Activity(actid),
FOREIGN KEY (stuid) REFERENCES Student(StuID)
);
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER,
FOREIGN KEY (actid) REFERENCES Activity(actid),
FOREIGN KEY (FacID) REFERENCES Faculty(FacID)
);
CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
CREATE TABLE Faculty (
FacID INTEGER PRIMARY KEY,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
); |
cre_Theme_park | {"Ref_Hotel_Star_Ratings": {"columns": [[0, "star_rating_code", "CHAR(15)", 1, null, 1], [1, "star_rating_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["star_rating_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "star_rating_code"]]], "check_constraints": []}, "Locations": {"columns": [[0, "Location_ID", "INTEGER", 1, null, 1], [1, "Location_Name", "VARCHAR(255)", 0, null, 0], [2, "Address", "VARCHAR(255)", 0, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Location_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Ref_Attraction_Types": {"columns": [[0, "Attraction_Type_Code", "CHAR(15)", 1, null, 1], [1, "Attraction_Type_Description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Attraction_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Attraction_Type_Code"]]], "check_constraints": []}, "Visitors": {"columns": [[0, "Tourist_ID", "INTEGER", 1, null, 1], [1, "Tourist_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Tourist_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Tourist_ID"]]], "check_constraints": []}, "Features": {"columns": [[0, "Feature_ID", "INTEGER", 1, null, 1], [1, "Feature_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Feature_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Hotels": {"columns": [[0, "hotel_id", "INTEGER", 1, null, 1], [1, "star_rating_code", "CHAR(15)", 1, null, 0], [2, "pets_allowed_yn", "CHAR(1)", 0, null, 0], [3, "price_range", "REAL", 0, null, 0], [4, "other_hotel_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["hotel_id"], "foreign_keys": [[0, 0, "Ref_Hotel_Star_Ratings", "star_rating_code", "star_rating_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Tourist_Attractions": {"columns": [[0, "Tourist_Attraction_ID", "INTEGER", 1, null, 1], [1, "Attraction_Type_Code", "CHAR(15)", 1, null, 0], [2, "Location_ID", "INTEGER", 1, null, 0], [3, "How_to_Get_There", "VARCHAR(255)", 0, null, 0], [4, "Name", "VARCHAR(255)", 0, null, 0], [5, "Description", "VARCHAR(255)", 0, null, 0], [6, "Opening_Hours", "VARCHAR(255)", 0, null, 0], [7, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Tourist_Attraction_ID"], "foreign_keys": [[0, 0, "Ref_Attraction_Types", "Attraction_Type_Code", "Attraction_Type_Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Locations", "Location_ID", "Location_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Street_Markets": {"columns": [[0, "Market_ID", "INTEGER", 1, null, 1], [1, "Market_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Market_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Market_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Shops": {"columns": [[0, "Shop_ID", "INTEGER", 1, null, 1], [1, "Shop_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Shop_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Shop_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Museums": {"columns": [[0, "Museum_ID", "INTEGER", 1, null, 1], [1, "Museum_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Museum_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Museum_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Royal_Family": {"columns": [[0, "Royal_Family_ID", "INTEGER", 1, null, 1], [1, "Royal_Family_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Royal_Family_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Royal_Family_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Theme_Parks": {"columns": [[0, "Theme_Park_ID", "INTEGER", 1, null, 1], [1, "Theme_Park_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Theme_Park_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Theme_Park_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Visits": {"columns": [[0, "Visit_ID", "INTEGER", 1, null, 1], [1, "Tourist_Attraction_ID", "INTEGER", 1, null, 0], [2, "Tourist_ID", "INTEGER", 1, null, 0], [3, "Visit_Date", "DATETIME", 1, null, 0], [4, "Visit_Details", "VARCHAR(40)", 1, null, 0]], "primary_keys": ["Visit_ID"], "foreign_keys": [[0, 0, "Visitors", "Tourist_ID", "Tourist_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Tourist_Attractions", "Tourist_Attraction_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Photos": {"columns": [[0, "Photo_ID", "INTEGER", 1, null, 1], [1, "Tourist_Attraction_ID", "INTEGER", 1, null, 0], [2, "Name", "VARCHAR(255)", 0, null, 0], [3, "Description", "VARCHAR(255)", 0, null, 0], [4, "Filename", "VARCHAR(255)", 0, null, 0], [5, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Photo_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Tourist_Attraction_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Staff": {"columns": [[0, "Staff_ID", "INTEGER", 1, null, 1], [1, "Tourist_Attraction_ID", "INTEGER", 1, null, 0], [2, "Name", "VARCHAR(40)", 0, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Staff_ID"], "foreign_keys": [[0, 0, "Tourist_Attractions", "Tourist_Attraction_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Tourist_Attraction_Features": {"columns": [[0, "Tourist_Attraction_ID", "INTEGER", 1, null, 1], [1, "Feature_ID", "INTEGER", 1, null, 2]], "primary_keys": ["Tourist_Attraction_ID", "Feature_ID"], "foreign_keys": [[0, 0, "Features", "Feature_ID", "Feature_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Tourist_Attractions", "Tourist_Attraction_ID", "Tourist_Attraction_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Tourist_Attraction_ID"], [1, 1, "Feature_ID"]]], "check_constraints": []}} | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL PRIMARY KEY,
star_rating_description VARCHAR(80),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL PRIMARY KEY,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Attraction_Type_Description VARCHAR(255),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL PRIMARY KEY,
Tourist_Details VARCHAR(255),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL PRIMARY KEY,
Feature_Details VARCHAR(255)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL PRIMARY KEY,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range REAL,
other_hotel_details VARCHAR(255),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings(star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL PRIMARY KEY,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types(Attraction_Type_Code),
FOREIGN KEY (Location_ID) REFERENCES Locations(Location_ID)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL PRIMARY KEY,
Market_Details VARCHAR(255),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL PRIMARY KEY,
Shop_Details VARCHAR(255),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL PRIMARY KEY,
Museum_Details VARCHAR(255),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL PRIMARY KEY,
Royal_Family_Details VARCHAR(255),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL PRIMARY KEY,
Theme_Park_Details VARCHAR(255),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL PRIMARY KEY,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
FOREIGN KEY (Tourist_ID) REFERENCES Visitors(Tourist_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL PRIMARY KEY,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL PRIMARY KEY,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL PRIMARY KEY,
Feature_ID INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
UNIQUE (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features(Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions(Tourist_Attraction_ID)
); |
flight_company | {"airport": {"columns": [[0, "id", "INT", 0, null, 1], [1, "City", "TEXT", 0, null, 0], [2, "Country", "TEXT", 0, null, 0], [3, "IATA", "TEXT", 0, null, 0], [4, "ICAO", "TEXT", 0, null, 0], [5, "name", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "operate_company": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Type", "TEXT", 0, null, 0], [3, "Principal_activities", "TEXT", 0, null, 0], [4, "Incorporated_in", "TEXT", 0, null, 0], [5, "Group_Equity_Shareholding", "REAL", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "flight": {"columns": [[0, "id", "INT", 0, null, 1], [1, "Vehicle_Flight_number", "TEXT", 0, null, 0], [2, "Date", "TEXT", 0, null, 0], [3, "Pilot", "TEXT", 0, null, 0], [4, "Velocity", "REAL", 0, null, 0], [5, "Altitude", "REAL", 0, null, 0], [6, "airport_id", "INT", 0, null, 0], [7, "company_id", "INT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "operate_company", "company_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "airport", "airport_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}} | CREATE TABLE airport (
id INT PRIMARY KEY,
City TEXT,
Country TEXT,
IATA TEXT,
ICAO TEXT,
name TEXT,
UNIQUE (id)
);
CREATE TABLE operate_company (
id INT PRIMARY KEY,
name TEXT,
Type TEXT,
Principal_activities TEXT,
Incorporated_in TEXT,
Group_Equity_Shareholding REAL,
UNIQUE (id)
);
CREATE TABLE flight (
id INT PRIMARY KEY,
Vehicle_Flight_number TEXT,
Date TEXT,
Pilot TEXT,
Velocity REAL,
Altitude REAL,
airport_id INT,
company_id INT,
UNIQUE (id),
FOREIGN KEY (company_id) REFERENCES operate_company(id),
FOREIGN KEY (airport_id) REFERENCES airport(id)
); |
dog_kennels | {"Breeds": {"columns": [[0, "breed_code", "VARCHAR(10)", 0, null, 1], [1, "breed_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["breed_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "breed_code"]]], "check_constraints": []}, "Charges": {"columns": [[0, "charge_id", "INTEGER", 0, null, 1], [1, "charge_type", "VARCHAR(10)", 0, null, 0], [2, "charge_amount", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["charge_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Sizes": {"columns": [[0, "size_code", "VARCHAR(10)", 0, null, 1], [1, "size_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["size_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "size_code"]]], "check_constraints": []}, "Treatment_Types": {"columns": [[0, "treatment_type_code", "VARCHAR(10)", 0, null, 1], [1, "treatment_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["treatment_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "treatment_type_code"]]], "check_constraints": []}, "Owners": {"columns": [[0, "owner_id", "INTEGER", 0, null, 1], [1, "first_name", "VARCHAR(50)", 0, null, 0], [2, "last_name", "VARCHAR(50)", 0, null, 0], [3, "street", "VARCHAR(50)", 0, null, 0], [4, "city", "VARCHAR(50)", 0, null, 0], [5, "state", "VARCHAR(20)", 0, null, 0], [6, "zip_code", "VARCHAR(20)", 0, null, 0], [7, "email_address", "VARCHAR(50)", 0, null, 0], [8, "home_phone", "VARCHAR(20)", 0, null, 0], [9, "cell_number", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["owner_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Dogs": {"columns": [[0, "dog_id", "INTEGER", 0, null, 1], [1, "owner_id", "INTEGER", 1, null, 0], [2, "abandoned_yn", "VARCHAR(1)", 0, null, 0], [3, "breed_code", "VARCHAR(10)", 1, null, 0], [4, "size_code", "VARCHAR(10)", 1, null, 0], [5, "name", "VARCHAR(50)", 0, null, 0], [6, "age", "VARCHAR(20)", 0, null, 0], [7, "date_of_birth", "DATETIME", 0, null, 0], [8, "gender", "VARCHAR(1)", 0, null, 0], [9, "weight", "VARCHAR(20)", 0, null, 0], [10, "date_arrived", "DATETIME", 0, null, 0], [11, "date_adopted", "DATETIME", 0, null, 0], [12, "date_departed", "DATETIME", 0, null, 0]], "primary_keys": ["dog_id"], "foreign_keys": [[0, 0, "Owners", "owner_id", "owner_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Owners", "owner_id", "owner_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Sizes", "size_code", "size_code", "NO ACTION", "NO ACTION", "NONE"], [3, 0, "Breeds", "breed_code", "breed_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Professionals": {"columns": [[0, "professional_id", "INTEGER", 0, null, 1], [1, "role_code", "VARCHAR(10)", 1, null, 0], [2, "first_name", "VARCHAR(50)", 0, null, 0], [3, "street", "VARCHAR(50)", 0, null, 0], [4, "city", "VARCHAR(50)", 0, null, 0], [5, "state", "VARCHAR(20)", 0, null, 0], [6, "zip_code", "VARCHAR(20)", 0, null, 0], [7, "last_name", "VARCHAR(50)", 0, null, 0], [8, "email_address", "VARCHAR(50)", 0, null, 0], [9, "home_phone", "VARCHAR(20)", 0, null, 0], [10, "cell_number", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["professional_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Treatments": {"columns": [[0, "treatment_id", "INTEGER", 0, null, 1], [1, "dog_id", "INTEGER", 1, null, 0], [2, "professional_id", "INTEGER", 1, null, 0], [3, "treatment_type_code", "VARCHAR(10)", 1, null, 0], [4, "date_of_treatment", "DATETIME", 0, null, 0], [5, "cost_of_treatment", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["treatment_id"], "foreign_keys": [[0, 0, "Dogs", "dog_id", "dog_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Professionals", "professional_id", "professional_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Treatment_Types", "treatment_type_code", "treatment_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Breeds (
breed_code VARCHAR(10) PRIMARY KEY,
breed_name VARCHAR(80),
UNIQUE (breed_code)
);
CREATE TABLE Charges (
charge_id INTEGER PRIMARY KEY,
charge_type VARCHAR(10),
charge_amount DECIMAL(19,4)
);
CREATE TABLE Sizes (
size_code VARCHAR(10) PRIMARY KEY,
size_description VARCHAR(80),
UNIQUE (size_code)
);
CREATE TABLE Treatment_Types (
treatment_type_code VARCHAR(10) PRIMARY KEY,
treatment_type_description VARCHAR(80),
UNIQUE (treatment_type_code)
);
CREATE TABLE Owners (
owner_id INTEGER PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
street VARCHAR(50),
city VARCHAR(50),
state VARCHAR(20),
zip_code VARCHAR(20),
email_address VARCHAR(50),
home_phone VARCHAR(20),
cell_number VARCHAR(20)
);
CREATE TABLE Dogs (
dog_id INTEGER PRIMARY KEY,
owner_id INTEGER NOT NULL,
abandoned_yn VARCHAR(1),
breed_code VARCHAR(10) NOT NULL,
size_code VARCHAR(10) NOT NULL,
name VARCHAR(50),
age VARCHAR(20),
date_of_birth DATETIME,
gender VARCHAR(1),
weight VARCHAR(20),
date_arrived DATETIME,
date_adopted DATETIME,
date_departed DATETIME,
FOREIGN KEY (owner_id) REFERENCES Owners(owner_id),
FOREIGN KEY (owner_id) REFERENCES Owners(owner_id),
FOREIGN KEY (size_code) REFERENCES Sizes(size_code),
FOREIGN KEY (breed_code) REFERENCES Breeds(breed_code)
);
CREATE TABLE Professionals (
professional_id INTEGER PRIMARY KEY,
role_code VARCHAR(10) NOT NULL,
first_name VARCHAR(50),
street VARCHAR(50),
city VARCHAR(50),
state VARCHAR(20),
zip_code VARCHAR(20),
last_name VARCHAR(50),
email_address VARCHAR(50),
home_phone VARCHAR(20),
cell_number VARCHAR(20)
);
CREATE TABLE Treatments (
treatment_id INTEGER PRIMARY KEY,
dog_id INTEGER NOT NULL,
professional_id INTEGER NOT NULL,
treatment_type_code VARCHAR(10) NOT NULL,
date_of_treatment DATETIME,
cost_of_treatment DECIMAL(19,4),
FOREIGN KEY (dog_id) REFERENCES Dogs(dog_id),
FOREIGN KEY (professional_id) REFERENCES Professionals(professional_id),
FOREIGN KEY (treatment_type_code) REFERENCES Treatment_Types(treatment_type_code)
); |
network_1 | {"Highschooler": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "grade", "INT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "Friend": {"columns": [[0, "student_id", "INT", 0, null, 1], [1, "friend_id", "INT", 0, null, 2]], "primary_keys": ["student_id", "friend_id"], "foreign_keys": [[0, 0, "Highschooler", "friend_id", "ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Highschooler", "student_id", "ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "student_id"], [1, 1, "friend_id"]]], "check_constraints": []}, "Likes": {"columns": [[0, "student_id", "INT", 0, null, 1], [1, "liked_id", "INT", 0, null, 2]], "primary_keys": ["student_id", "liked_id"], "foreign_keys": [[0, 0, "Highschooler", "student_id", "ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Highschooler", "liked_id", "ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "student_id"], [1, 1, "liked_id"]]], "check_constraints": []}} | CREATE TABLE Highschooler (
ID INT PRIMARY KEY,
name TEXT,
grade INT,
UNIQUE (ID)
);
CREATE TABLE Friend (
student_id INT PRIMARY KEY,
friend_id INT PRIMARY KEY,
PRIMARY KEY (student_id, friend_id),
UNIQUE (student_id, friend_id),
FOREIGN KEY (friend_id) REFERENCES Highschooler(ID),
FOREIGN KEY (student_id) REFERENCES Highschooler(ID)
);
CREATE TABLE Likes (
student_id INT PRIMARY KEY,
liked_id INT PRIMARY KEY,
PRIMARY KEY (student_id, liked_id),
UNIQUE (student_id, liked_id),
FOREIGN KEY (student_id) REFERENCES Highschooler(ID),
FOREIGN KEY (liked_id) REFERENCES Highschooler(ID)
); |
car_1 | {"continents": {"columns": [[0, "ContId", "INTEGER", 0, null, 1], [1, "Continent", "TEXT", 0, null, 0]], "primary_keys": ["ContId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "countries": {"columns": [[0, "CountryId", "INTEGER", 0, null, 1], [1, "CountryName", "TEXT", 0, null, 0], [2, "Continent", "INTEGER", 0, null, 0]], "primary_keys": ["CountryId"], "foreign_keys": [[0, 0, "continents", "Continent", "ContId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "car_makers": {"columns": [[0, "Id", "INTEGER", 0, null, 1], [1, "Maker", "TEXT", 0, null, 0], [2, "FullName", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0]], "primary_keys": ["Id"], "foreign_keys": [[0, 0, "countries", "Country", "CountryId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "model_list": {"columns": [[0, "ModelId", "INTEGER", 0, null, 1], [1, "Maker", "INTEGER", 0, null, 0], [2, "Model", "TEXT", 0, null, 0]], "primary_keys": ["ModelId"], "foreign_keys": [[0, 0, "car_makers", "Maker", "Id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 2, "Model"]]], "check_constraints": []}, "car_names": {"columns": [[0, "MakeId", "INTEGER", 0, null, 1], [1, "Model", "TEXT", 0, null, 0], [2, "Make", "TEXT", 0, null, 0]], "primary_keys": ["MakeId"], "foreign_keys": [[0, 0, "model_list", "Model", "Model", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "cars_data": {"columns": [[0, "Id", "INTEGER", 0, null, 1], [1, "MPG", "TEXT", 0, null, 0], [2, "Cylinders", "INTEGER", 0, null, 0], [3, "Edispl", "REAL", 0, null, 0], [4, "Horsepower", "TEXT", 0, null, 0], [5, "Weight", "INTEGER", 0, null, 0], [6, "Accelerate", "REAL", 0, null, 0], [7, "Year", "INTEGER", 0, null, 0]], "primary_keys": ["Id"], "foreign_keys": [[0, 0, "car_names", "Id", "MakeId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE continents (
ContId INTEGER PRIMARY KEY,
Continent TEXT
);
CREATE TABLE countries (
CountryId INTEGER PRIMARY KEY,
CountryName TEXT,
Continent INTEGER,
FOREIGN KEY (Continent) REFERENCES continents(ContId)
);
CREATE TABLE car_makers (
Id INTEGER PRIMARY KEY,
Maker TEXT,
FullName TEXT,
Country TEXT,
FOREIGN KEY (Country) REFERENCES countries(CountryId)
);
CREATE TABLE model_list (
ModelId INTEGER PRIMARY KEY,
Maker INTEGER,
Model TEXT,
UNIQUE (Model),
FOREIGN KEY (Maker) REFERENCES car_makers(Id)
);
CREATE TABLE car_names (
MakeId INTEGER PRIMARY KEY,
Model TEXT,
Make TEXT,
FOREIGN KEY (Model) REFERENCES model_list(Model)
);
CREATE TABLE cars_data (
Id INTEGER PRIMARY KEY,
MPG TEXT,
Cylinders INTEGER,
Edispl REAL,
Horsepower TEXT,
Weight INTEGER,
Accelerate REAL,
Year INTEGER,
FOREIGN KEY (Id) REFERENCES car_names(MakeId)
); |
formula_1 | {"circuits": {"columns": [[0, "circuitId", "INTEGER", 0, null, 1], [1, "circuitRef", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "location", "TEXT", 0, null, 0], [4, "country", "TEXT", 0, null, 0], [5, "lat", "REAL", 0, null, 0], [6, "lng", "REAL", 0, null, 0], [7, "alt", "TEXT", 0, null, 0], [8, "url", "TEXT", 0, null, 0]], "primary_keys": ["circuitId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "races": {"columns": [[0, "raceId", "INTEGER", 0, null, 1], [1, "year", "INTEGER", 0, null, 0], [2, "round", "INTEGER", 0, null, 0], [3, "circuitId", "INTEGER", 0, null, 0], [4, "name", "TEXT", 0, null, 0], [5, "date", "TEXT", 0, null, 0], [6, "time", "TEXT", 0, null, 0], [7, "url", "TEXT", 0, null, 0]], "primary_keys": ["raceId"], "foreign_keys": [[0, 0, "circuits", "circuitId", "circuitId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "drivers": {"columns": [[0, "driverId", "INTEGER", 0, null, 1], [1, "driverRef", "TEXT", 0, null, 0], [2, "number", "TEXT", 0, null, 0], [3, "code", "TEXT", 0, null, 0], [4, "forename", "TEXT", 0, null, 0], [5, "surname", "TEXT", 0, null, 0], [6, "dob", "TEXT", 0, null, 0], [7, "nationality", "TEXT", 0, null, 0], [8, "url", "TEXT", 0, null, 0]], "primary_keys": ["driverId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "status": {"columns": [[0, "statusId", "INTEGER", 0, null, 1], [1, "status", "TEXT", 0, null, 0]], "primary_keys": ["statusId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "seasons": {"columns": [[0, "year", "INTEGER", 0, null, 1], [1, "url", "TEXT", 0, null, 0]], "primary_keys": ["year"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "constructors": {"columns": [[0, "constructorId", "INTEGER", 0, null, 1], [1, "constructorRef", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "nationality", "TEXT", 0, null, 0], [4, "url", "TEXT", 0, null, 0]], "primary_keys": ["constructorId"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "constructorStandings": {"columns": [[0, "constructorStandingsId", "INTEGER", 0, null, 1], [1, "raceId", "INTEGER", 0, null, 0], [2, "constructorId", "INTEGER", 0, null, 0], [3, "points", "REAL", 0, null, 0], [4, "position", "INTEGER", 0, null, 0], [5, "positionText", "TEXT", 0, null, 0], [6, "wins", "INTEGER", 0, null, 0]], "primary_keys": ["constructorStandingsId"], "foreign_keys": [[0, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "constructors", "constructorId", "constructorId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "results": {"columns": [[0, "resultId", "INTEGER", 0, null, 1], [1, "raceId", "INTEGER", 0, null, 0], [2, "driverId", "INTEGER", 0, null, 0], [3, "constructorId", "INTEGER", 0, null, 0], [4, "number", "INTEGER", 0, null, 0], [5, "grid", "INTEGER", 0, null, 0], [6, "position", "TEXT", 0, null, 0], [7, "positionText", "TEXT", 0, null, 0], [8, "positionOrder", "INTEGER", 0, null, 0], [9, "points", "REAL", 0, null, 0], [10, "laps", "TEXT", 0, null, 0], [11, "time", "TEXT", 0, null, 0], [12, "milliseconds", "TEXT", 0, null, 0], [13, "fastestLap", "TEXT", 0, null, 0], [14, "rank", "TEXT", 0, null, 0], [15, "fastestLapTime", "TEXT", 0, null, 0], [16, "fastestLapSpeed", "TEXT", 0, null, 0], [17, "statusId", "INTEGER", 0, null, 0]], "primary_keys": ["resultId"], "foreign_keys": [[0, 0, "drivers", "driverId", "driverId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "constructors", "constructorId", "constructorId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "driverStandings": {"columns": [[0, "driverStandingsId", "INTEGER", 0, null, 1], [1, "raceId", "INTEGER", 0, null, 0], [2, "driverId", "INTEGER", 0, null, 0], [3, "points", "REAL", 0, null, 0], [4, "position", "INTEGER", 0, null, 0], [5, "positionText", "TEXT", 0, null, 0], [6, "wins", "INTEGER", 0, null, 0]], "primary_keys": ["driverStandingsId"], "foreign_keys": [[0, 0, "drivers", "driverId", "driverId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "constructorResults": {"columns": [[0, "constructorResultsId", "INTEGER", 0, null, 1], [1, "raceId", "INTEGER", 0, null, 0], [2, "constructorId", "INTEGER", 0, null, 0], [3, "points", "REAL", 0, null, 0], [4, "status", "TEXT", 0, null, 0]], "primary_keys": ["constructorResultsId"], "foreign_keys": [[0, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "constructors", "constructorId", "constructorId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "qualifying": {"columns": [[0, "qualifyId", "INTEGER", 0, null, 1], [1, "raceId", "INTEGER", 0, null, 0], [2, "driverId", "INTEGER", 0, null, 0], [3, "constructorId", "INTEGER", 0, null, 0], [4, "number", "INTEGER", 0, null, 0], [5, "position", "INTEGER", 0, null, 0], [6, "q1", "TEXT", 0, null, 0], [7, "q2", "TEXT", 0, null, 0], [8, "q3", "TEXT", 0, null, 0]], "primary_keys": ["qualifyId"], "foreign_keys": [[0, 0, "drivers", "driverId", "driverId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "constructors", "constructorId", "constructorId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "pitStops": {"columns": [[0, "raceId", "INTEGER", 0, null, 1], [1, "driverId", "INTEGER", 0, null, 2], [2, "stop", "INTEGER", 0, null, 3], [3, "lap", "INTEGER", 0, null, 0], [4, "time", "TEXT", 0, null, 0], [5, "duration", "TEXT", 0, null, 0], [6, "milliseconds", "INTEGER", 0, null, 0]], "primary_keys": ["raceId", "driverId", "stop"], "foreign_keys": [[0, 0, "drivers", "driverId", "driverId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "raceId"], [1, 1, "driverId"], [2, 2, "stop"]]], "check_constraints": []}, "lapTimes": {"columns": [[0, "raceId", "INTEGER", 0, null, 1], [1, "driverId", "INTEGER", 0, null, 2], [2, "lap", "INTEGER", 0, null, 3], [3, "position", "INTEGER", 0, null, 0], [4, "time", "TEXT", 0, null, 0], [5, "milliseconds", "INTEGER", 0, null, 0]], "primary_keys": ["raceId", "driverId", "lap"], "foreign_keys": [[0, 0, "drivers", "driverId", "driverId", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "races", "raceId", "raceId", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "raceId"], [1, 1, "driverId"], [2, 2, "lap"]]], "check_constraints": []}} | CREATE TABLE circuits (
circuitId INTEGER PRIMARY KEY,
circuitRef TEXT,
name TEXT,
location TEXT,
country TEXT,
lat REAL,
lng REAL,
alt TEXT,
url TEXT
);
CREATE TABLE races (
raceId INTEGER PRIMARY KEY,
year INTEGER,
round INTEGER,
circuitId INTEGER,
name TEXT,
date TEXT,
time TEXT,
url TEXT,
FOREIGN KEY (circuitId) REFERENCES circuits(circuitId)
);
CREATE TABLE drivers (
driverId INTEGER PRIMARY KEY,
driverRef TEXT,
number TEXT,
code TEXT,
forename TEXT,
surname TEXT,
dob TEXT,
nationality TEXT,
url TEXT
);
CREATE TABLE status (
statusId INTEGER PRIMARY KEY,
status TEXT
);
CREATE TABLE seasons (
year INTEGER PRIMARY KEY,
url TEXT
);
CREATE TABLE constructors (
constructorId INTEGER PRIMARY KEY,
constructorRef TEXT,
name TEXT,
nationality TEXT,
url TEXT
);
CREATE TABLE constructorStandings (
constructorStandingsId INTEGER PRIMARY KEY,
raceId INTEGER,
constructorId INTEGER,
points REAL,
position INTEGER,
positionText TEXT,
wins INTEGER,
FOREIGN KEY (raceId) REFERENCES races(raceId),
FOREIGN KEY (constructorId) REFERENCES constructors(constructorId)
);
CREATE TABLE results (
resultId INTEGER PRIMARY KEY,
raceId INTEGER,
driverId INTEGER,
constructorId INTEGER,
number INTEGER,
grid INTEGER,
position TEXT,
positionText TEXT,
positionOrder INTEGER,
points REAL,
laps TEXT,
time TEXT,
milliseconds TEXT,
fastestLap TEXT,
rank TEXT,
fastestLapTime TEXT,
fastestLapSpeed TEXT,
statusId INTEGER,
FOREIGN KEY (driverId) REFERENCES drivers(driverId),
FOREIGN KEY (raceId) REFERENCES races(raceId),
FOREIGN KEY (constructorId) REFERENCES constructors(constructorId)
);
CREATE TABLE driverStandings (
driverStandingsId INTEGER PRIMARY KEY,
raceId INTEGER,
driverId INTEGER,
points REAL,
position INTEGER,
positionText TEXT,
wins INTEGER,
FOREIGN KEY (driverId) REFERENCES drivers(driverId),
FOREIGN KEY (raceId) REFERENCES races(raceId)
);
CREATE TABLE constructorResults (
constructorResultsId INTEGER PRIMARY KEY,
raceId INTEGER,
constructorId INTEGER,
points REAL,
status TEXT,
FOREIGN KEY (raceId) REFERENCES races(raceId),
FOREIGN KEY (constructorId) REFERENCES constructors(constructorId)
);
CREATE TABLE qualifying (
qualifyId INTEGER PRIMARY KEY,
raceId INTEGER,
driverId INTEGER,
constructorId INTEGER,
number INTEGER,
position INTEGER,
q1 TEXT,
q2 TEXT,
q3 TEXT,
FOREIGN KEY (driverId) REFERENCES drivers(driverId),
FOREIGN KEY (raceId) REFERENCES races(raceId),
FOREIGN KEY (constructorId) REFERENCES constructors(constructorId)
);
CREATE TABLE pitStops (
raceId INTEGER PRIMARY KEY,
driverId INTEGER PRIMARY KEY,
stop INTEGER PRIMARY KEY,
lap INTEGER,
time TEXT,
duration TEXT,
milliseconds INTEGER,
PRIMARY KEY (raceId, driverId, stop),
UNIQUE (raceId, driverId, stop),
FOREIGN KEY (driverId) REFERENCES drivers(driverId),
FOREIGN KEY (raceId) REFERENCES races(raceId)
);
CREATE TABLE lapTimes (
raceId INTEGER PRIMARY KEY,
driverId INTEGER PRIMARY KEY,
lap INTEGER PRIMARY KEY,
position INTEGER,
time TEXT,
milliseconds INTEGER,
PRIMARY KEY (raceId, driverId, lap),
UNIQUE (raceId, driverId, lap),
FOREIGN KEY (driverId) REFERENCES drivers(driverId),
FOREIGN KEY (raceId) REFERENCES races(raceId)
); |
flight_4 | {"routes": {"columns": [[0, "rid", "INTEGER", 0, null, 1], [1, "dst_apid", "INTEGER", 0, null, 0], [2, "dst_ap", "varchar(4)", 0, null, 0], [3, "src_apid", "bigint", 0, null, 0], [4, "src_ap", "varchar(4)", 0, null, 0], [5, "alid", "bigint", 0, null, 0], [6, "airline", "varchar(4)", 0, null, 0], [7, "codeshare", "TEXT", 0, null, 0]], "primary_keys": ["rid"], "foreign_keys": [[0, 0, "airlines", "alid", "alid", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "airports", "src_apid", "apid", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "airports", "dst_apid", "apid", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "airports": {"columns": [[0, "apid", "INTEGER", 0, null, 1], [1, "name", "TEXT", 1, null, 0], [2, "city", "TEXT", 0, null, 0], [3, "country", "TEXT", 0, null, 0], [4, "x", "REAL", 0, null, 0], [5, "y", "REAL", 0, null, 0], [6, "elevation", "bigint", 0, null, 0], [7, "iata", "character varchar(3)", 0, null, 0], [8, "icao", "character varchar(4)", 0, null, 0]], "primary_keys": ["apid"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "airlines": {"columns": [[0, "alid", "INTEGER", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "iata", "varchar(2)", 0, null, 0], [3, "icao", "varchar(3)", 0, null, 0], [4, "callsign", "TEXT", 0, null, 0], [5, "country", "TEXT", 0, null, 0], [6, "active", "varchar(2)", 0, null, 0]], "primary_keys": ["alid"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE routes (
rid INTEGER PRIMARY KEY,
dst_apid INTEGER,
dst_ap varchar(4),
src_apid bigint,
src_ap varchar(4),
alid bigint,
airline varchar(4),
codeshare TEXT,
FOREIGN KEY (alid) REFERENCES airlines(alid),
FOREIGN KEY (src_apid) REFERENCES airports(apid),
FOREIGN KEY (dst_apid) REFERENCES airports(apid)
);
CREATE TABLE airports (
apid INTEGER PRIMARY KEY,
name TEXT NOT NULL,
city TEXT,
country TEXT,
x REAL,
y REAL,
elevation bigint,
iata character varchar(3),
icao character varchar(4)
);
CREATE TABLE airlines (
alid INTEGER PRIMARY KEY,
name TEXT,
iata varchar(2),
icao varchar(3),
callsign TEXT,
country TEXT,
active varchar(2)
); |
employee_hire_evaluation | {"employee": {"columns": [[0, "Employee_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Age", "INT", 0, null, 0], [3, "City", "TEXT", 0, null, 0]], "primary_keys": ["Employee_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Employee_ID"]]], "check_constraints": []}, "shop": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "District", "TEXT", 0, null, 0], [4, "Number_products", "INT", 0, null, 0], [5, "Manager_name", "TEXT", 0, null, 0]], "primary_keys": ["Shop_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Shop_ID"]]], "check_constraints": []}, "hiring": {"columns": [[0, "Shop_ID", "INT", 0, null, 0], [1, "Employee_ID", "INT", 0, null, 1], [2, "Start_from", "TEXT", 0, null, 0], [3, "Is_full_time", "bool", 0, null, 0]], "primary_keys": ["Employee_ID"], "foreign_keys": [[0, 0, "employee", "Employee_ID", "Employee_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "shop", "Shop_ID", "Shop_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 1, "Employee_ID"]]], "check_constraints": []}, "evaluation": {"columns": [[0, "Employee_ID", "TEXT", 0, null, 1], [1, "Year_awarded", "TEXT", 0, null, 2], [2, "Bonus", "REAL", 0, null, 0]], "primary_keys": ["Employee_ID", "Year_awarded"], "foreign_keys": [[0, 0, "employee", "Employee_ID", "Employee_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Employee_ID"], [1, 1, "Year_awarded"]]], "check_constraints": []}} | CREATE TABLE employee (
Employee_ID INT PRIMARY KEY,
Name TEXT,
Age INT,
City TEXT,
UNIQUE (Employee_ID)
);
CREATE TABLE shop (
Shop_ID INT PRIMARY KEY,
Name TEXT,
Location TEXT,
District TEXT,
Number_products INT,
Manager_name TEXT,
UNIQUE (Shop_ID)
);
CREATE TABLE hiring (
Shop_ID INT,
Employee_ID INT PRIMARY KEY,
Start_from TEXT,
Is_full_time bool,
UNIQUE (Employee_ID),
FOREIGN KEY (Employee_ID) REFERENCES employee(Employee_ID),
FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)
);
CREATE TABLE evaluation (
Employee_ID TEXT PRIMARY KEY,
Year_awarded TEXT PRIMARY KEY,
Bonus REAL,
PRIMARY KEY (Employee_ID, Year_awarded),
UNIQUE (Employee_ID, Year_awarded),
FOREIGN KEY (Employee_ID) REFERENCES employee(Employee_ID)
); |
news_report | {"event": {"columns": [[0, "Event_ID", "INT", 0, null, 1], [1, "Date", "TEXT", 0, null, 0], [2, "Venue", "TEXT", 0, null, 0], [3, "Name", "TEXT", 0, null, 0], [4, "Event_Attendance", "INT", 0, null, 0]], "primary_keys": ["Event_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Event_ID"]]], "check_constraints": []}, "journalist": {"columns": [[0, "journalist_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Nationality", "TEXT", 0, null, 0], [3, "Age", "TEXT", 0, null, 0], [4, "Years_working", "INT", 0, null, 0]], "primary_keys": ["journalist_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "journalist_ID"]]], "check_constraints": []}, "news_report": {"columns": [[0, "journalist_ID", "INT", 0, null, 1], [1, "Event_ID", "INT", 0, null, 2], [2, "Work_Type", "TEXT", 0, null, 0]], "primary_keys": ["journalist_ID", "Event_ID"], "foreign_keys": [[0, 0, "event", "Event_ID", "Event_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "journalist", "journalist_ID", "journalist_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "journalist_ID"], [1, 1, "Event_ID"]]], "check_constraints": []}} | CREATE TABLE event (
Event_ID INT PRIMARY KEY,
Date TEXT,
Venue TEXT,
Name TEXT,
Event_Attendance INT,
UNIQUE (Event_ID)
);
CREATE TABLE journalist (
journalist_ID INT PRIMARY KEY,
Name TEXT,
Nationality TEXT,
Age TEXT,
Years_working INT,
UNIQUE (journalist_ID)
);
CREATE TABLE news_report (
journalist_ID INT PRIMARY KEY,
Event_ID INT PRIMARY KEY,
Work_Type TEXT,
PRIMARY KEY (journalist_ID, Event_ID),
UNIQUE (journalist_ID, Event_ID),
FOREIGN KEY (Event_ID) REFERENCES event(Event_ID),
FOREIGN KEY (journalist_ID) REFERENCES journalist(journalist_ID)
); |
hospital_1 | {"Physician": {"columns": [[0, "EmployeeID", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Position", "VARCHAR(30)", 1, null, 0], [3, "SSN", "INTEGER", 1, null, 0]], "primary_keys": ["EmployeeID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Department": {"columns": [[0, "DepartmentID", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Head", "INTEGER", 1, null, 0]], "primary_keys": ["DepartmentID"], "foreign_keys": [[0, 0, "Physician", "Head", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Affiliated_With": {"columns": [[0, "Physician", "INTEGER", 1, null, 1], [1, "Department", "INTEGER", 1, null, 2], [2, "PrimaryAffiliation", "BOOLEAN", 1, null, 0]], "primary_keys": ["Physician", "Department"], "foreign_keys": [[0, 0, "Department", "Department", "DepartmentID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Physician", "Physician", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Physician"], [1, 1, "Department"]]], "check_constraints": []}, "Procedures": {"columns": [[0, "Code", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Cost", "REAL", 1, null, 0]], "primary_keys": ["Code"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Trained_In": {"columns": [[0, "Physician", "INTEGER", 1, null, 1], [1, "Treatment", "INTEGER", 1, null, 2], [2, "CertificationDate", "DATETIME", 1, null, 0], [3, "CertificationExpires", "DATETIME", 1, null, 0]], "primary_keys": ["Physician", "Treatment"], "foreign_keys": [[0, 0, "Procedures", "Treatment", "Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Physician", "Physician", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Physician"], [1, 1, "Treatment"]]], "check_constraints": []}, "Patient": {"columns": [[0, "SSN", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Address", "VARCHAR(30)", 1, null, 0], [3, "Phone", "VARCHAR(30)", 1, null, 0], [4, "InsuranceID", "INTEGER", 1, null, 0], [5, "PCP", "INTEGER", 1, null, 0]], "primary_keys": ["SSN"], "foreign_keys": [[0, 0, "Physician", "PCP", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Nurse": {"columns": [[0, "EmployeeID", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Position", "VARCHAR(30)", 1, null, 0], [3, "Registered", "BOOLEAN", 1, null, 0], [4, "SSN", "INTEGER", 1, null, 0]], "primary_keys": ["EmployeeID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Appointment": {"columns": [[0, "AppointmentID", "INTEGER", 1, null, 1], [1, "Patient", "INTEGER", 1, null, 0], [2, "PrepNurse", "INTEGER", 0, null, 0], [3, "Physician", "INTEGER", 1, null, 0], [4, "Start", "DATETIME", 1, null, 0], [5, "End", "DATETIME", 1, null, 0], [6, "ExaminationRoom", "TEXT", 1, null, 0]], "primary_keys": ["AppointmentID"], "foreign_keys": [[0, 0, "Physician", "Physician", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Nurse", "PrepNurse", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Patient", "Patient", "SSN", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Medication": {"columns": [[0, "Code", "INTEGER", 1, null, 1], [1, "Name", "VARCHAR(30)", 1, null, 0], [2, "Brand", "VARCHAR(30)", 1, null, 0], [3, "Description", "VARCHAR(30)", 1, null, 0]], "primary_keys": ["Code"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Prescribes": {"columns": [[0, "Physician", "INTEGER", 1, null, 1], [1, "Patient", "INTEGER", 1, null, 2], [2, "Medication", "INTEGER", 1, null, 3], [3, "Date", "DATETIME", 1, null, 4], [4, "Appointment", "INTEGER", 0, null, 0], [5, "Dose", "VARCHAR(30)", 1, null, 0]], "primary_keys": ["Physician", "Patient", "Medication", "Date"], "foreign_keys": [[0, 0, "Appointment", "Appointment", "AppointmentID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Medication", "Medication", "Code", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Patient", "Patient", "SSN", "NO ACTION", "NO ACTION", "NONE"], [3, 0, "Physician", "Physician", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Physician"], [1, 1, "Patient"], [2, 2, "Medication"], [3, 3, "Date"]]], "check_constraints": []}, "Block": {"columns": [[0, "BlockFloor", "INTEGER", 1, null, 1], [1, "BlockCode", "INTEGER", 1, null, 2]], "primary_keys": ["BlockFloor", "BlockCode"], "foreign_keys": [], "unique_constraints": [[[0, 0, "BlockFloor"], [1, 1, "BlockCode"]]], "check_constraints": []}, "Room": {"columns": [[0, "RoomNumber", "INTEGER", 1, null, 1], [1, "RoomType", "VARCHAR(30)", 1, null, 0], [2, "BlockFloor", "INTEGER", 1, null, 0], [3, "BlockCode", "INTEGER", 1, null, 0], [4, "Unavailable", "BOOLEAN", 1, null, 0]], "primary_keys": ["RoomNumber"], "foreign_keys": [[0, 0, "Block", "BlockFloor", "BlockFloor", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Block", "BlockCode", "BlockCode", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "On_Call": {"columns": [[0, "Nurse", "INTEGER", 1, null, 1], [1, "BlockFloor", "INTEGER", 1, null, 2], [2, "BlockCode", "INTEGER", 1, null, 3], [3, "OnCallStart", "DATETIME", 1, null, 4], [4, "OnCallEnd", "DATETIME", 1, null, 5]], "primary_keys": ["Nurse", "BlockFloor", "BlockCode", "OnCallStart", "OnCallEnd"], "foreign_keys": [[0, 0, "Block", "BlockFloor", "BlockFloor", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Block", "BlockCode", "BlockCode", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Nurse", "Nurse", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Nurse"], [1, 1, "BlockFloor"], [2, 2, "BlockCode"], [3, 3, "OnCallStart"], [4, 4, "OnCallEnd"]]], "check_constraints": []}, "Stay": {"columns": [[0, "StayID", "INTEGER", 1, null, 1], [1, "Patient", "INTEGER", 1, null, 0], [2, "Room", "INTEGER", 1, null, 0], [3, "StayStart", "DATETIME", 1, null, 0], [4, "StayEnd", "DATETIME", 1, null, 0]], "primary_keys": ["StayID"], "foreign_keys": [[0, 0, "Room", "Room", "RoomNumber", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Patient", "Patient", "SSN", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Undergoes": {"columns": [[0, "Patient", "INTEGER", 1, null, 1], [1, "Procedures", "INTEGER", 1, null, 2], [2, "Stay", "INTEGER", 1, null, 3], [3, "DateUndergoes", "DATETIME", 1, null, 4], [4, "Physician", "INTEGER", 1, null, 0], [5, "AssistingNurse", "INTEGER", 0, null, 0]], "primary_keys": ["Patient", "Procedures", "Stay", "DateUndergoes"], "foreign_keys": [[0, 0, "Nurse", "AssistingNurse", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Physician", "Physician", "EmployeeID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Stay", "Stay", "StayID", "NO ACTION", "NO ACTION", "NONE"], [3, 0, "Procedures", "Procedures", "Code", "NO ACTION", "NO ACTION", "NONE"], [4, 0, "Patient", "Patient", "SSN", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Patient"], [1, 1, "Procedures"], [2, 2, "Stay"], [3, 3, "DateUndergoes"]]], "check_constraints": []}} | CREATE TABLE Physician (
EmployeeID INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Position VARCHAR(30) NOT NULL,
SSN INTEGER NOT NULL
);
CREATE TABLE Department (
DepartmentID INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Head INTEGER NOT NULL,
FOREIGN KEY (Head) REFERENCES Physician(EmployeeID)
);
CREATE TABLE Affiliated_With (
Physician INTEGER NOT NULL PRIMARY KEY,
Department INTEGER NOT NULL PRIMARY KEY,
PrimaryAffiliation BOOLEAN NOT NULL,
PRIMARY KEY (Physician, Department),
UNIQUE (Physician, Department),
FOREIGN KEY (Department) REFERENCES Department(DepartmentID),
FOREIGN KEY (Physician) REFERENCES Physician(EmployeeID)
);
CREATE TABLE Procedures (
Code INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Cost REAL NOT NULL
);
CREATE TABLE Trained_In (
Physician INTEGER NOT NULL PRIMARY KEY,
Treatment INTEGER NOT NULL PRIMARY KEY,
CertificationDate DATETIME NOT NULL,
CertificationExpires DATETIME NOT NULL,
PRIMARY KEY (Physician, Treatment),
UNIQUE (Physician, Treatment),
FOREIGN KEY (Treatment) REFERENCES Procedures(Code),
FOREIGN KEY (Physician) REFERENCES Physician(EmployeeID)
);
CREATE TABLE Patient (
SSN INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Address VARCHAR(30) NOT NULL,
Phone VARCHAR(30) NOT NULL,
InsuranceID INTEGER NOT NULL,
PCP INTEGER NOT NULL,
FOREIGN KEY (PCP) REFERENCES Physician(EmployeeID)
);
CREATE TABLE Nurse (
EmployeeID INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Position VARCHAR(30) NOT NULL,
Registered BOOLEAN NOT NULL,
SSN INTEGER NOT NULL
);
CREATE TABLE Appointment (
AppointmentID INTEGER NOT NULL PRIMARY KEY,
Patient INTEGER NOT NULL,
PrepNurse INTEGER,
Physician INTEGER NOT NULL,
Start DATETIME NOT NULL,
End DATETIME NOT NULL,
ExaminationRoom TEXT NOT NULL,
FOREIGN KEY (Physician) REFERENCES Physician(EmployeeID),
FOREIGN KEY (PrepNurse) REFERENCES Nurse(EmployeeID),
FOREIGN KEY (Patient) REFERENCES Patient(SSN)
);
CREATE TABLE Medication (
Code INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(30) NOT NULL,
Brand VARCHAR(30) NOT NULL,
Description VARCHAR(30) NOT NULL
);
CREATE TABLE Prescribes (
Physician INTEGER NOT NULL PRIMARY KEY,
Patient INTEGER NOT NULL PRIMARY KEY,
Medication INTEGER NOT NULL PRIMARY KEY,
Date DATETIME NOT NULL PRIMARY KEY,
Appointment INTEGER,
Dose VARCHAR(30) NOT NULL,
PRIMARY KEY (Physician, Patient, Medication, Date),
UNIQUE (Physician, Patient, Medication, Date),
FOREIGN KEY (Appointment) REFERENCES Appointment(AppointmentID),
FOREIGN KEY (Medication) REFERENCES Medication(Code),
FOREIGN KEY (Patient) REFERENCES Patient(SSN),
FOREIGN KEY (Physician) REFERENCES Physician(EmployeeID)
);
CREATE TABLE Block (
BlockFloor INTEGER NOT NULL PRIMARY KEY,
BlockCode INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (BlockFloor, BlockCode),
UNIQUE (BlockFloor, BlockCode)
);
CREATE TABLE Room (
RoomNumber INTEGER NOT NULL PRIMARY KEY,
RoomType VARCHAR(30) NOT NULL,
BlockFloor INTEGER NOT NULL,
BlockCode INTEGER NOT NULL,
Unavailable BOOLEAN NOT NULL,
FOREIGN KEY (BlockFloor) REFERENCES Block(BlockFloor),
FOREIGN KEY (BlockCode) REFERENCES Block(BlockCode)
);
CREATE TABLE On_Call (
Nurse INTEGER NOT NULL PRIMARY KEY,
BlockFloor INTEGER NOT NULL PRIMARY KEY,
BlockCode INTEGER NOT NULL PRIMARY KEY,
OnCallStart DATETIME NOT NULL PRIMARY KEY,
OnCallEnd DATETIME NOT NULL PRIMARY KEY,
PRIMARY KEY (Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),
UNIQUE (Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),
FOREIGN KEY (BlockFloor) REFERENCES Block(BlockFloor),
FOREIGN KEY (BlockCode) REFERENCES Block(BlockCode),
FOREIGN KEY (Nurse) REFERENCES Nurse(EmployeeID)
);
CREATE TABLE Stay (
StayID INTEGER NOT NULL PRIMARY KEY,
Patient INTEGER NOT NULL,
Room INTEGER NOT NULL,
StayStart DATETIME NOT NULL,
StayEnd DATETIME NOT NULL,
FOREIGN KEY (Room) REFERENCES Room(RoomNumber),
FOREIGN KEY (Patient) REFERENCES Patient(SSN)
);
CREATE TABLE Undergoes (
Patient INTEGER NOT NULL PRIMARY KEY,
Procedures INTEGER NOT NULL PRIMARY KEY,
Stay INTEGER NOT NULL PRIMARY KEY,
DateUndergoes DATETIME NOT NULL PRIMARY KEY,
Physician INTEGER NOT NULL,
AssistingNurse INTEGER,
PRIMARY KEY (Patient, Procedures, Stay, DateUndergoes),
UNIQUE (Patient, Procedures, Stay, DateUndergoes),
FOREIGN KEY (AssistingNurse) REFERENCES Nurse(EmployeeID),
FOREIGN KEY (Physician) REFERENCES Physician(EmployeeID),
FOREIGN KEY (Stay) REFERENCES Stay(StayID),
FOREIGN KEY (Procedures) REFERENCES Procedures(Code),
FOREIGN KEY (Patient) REFERENCES Patient(SSN)
); |