db_id
stringlengths 3
31
| tables
stringlengths 629
17.5k
| schema
stringlengths 334
8.29k
|
---|---|---|
company_office | {"buildings": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "City", "TEXT", 0, null, 0], [3, "Height", "INT", 0, null, 0], [4, "Stories", "INT", 0, null, 0], [5, "Status", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "Companies": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Headquarters", "TEXT", 0, null, 0], [3, "Industry", "TEXT", 0, null, 0], [4, "Sales_billion", "REAL", 0, null, 0], [5, "Profits_billion", "REAL", 0, null, 0], [6, "Assets_billion", "REAL", 0, null, 0], [7, "Market_Value_billion", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "Office_locations": {"columns": [[0, "building_id", "INT", 0, null, 1], [1, "company_id", "INT", 0, null, 2], [2, "move_in_year", "INT", 0, null, 0]], "primary_keys": ["building_id", "company_id"], "foreign_keys": [[0, 0, "Companies", "company_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "buildings", "building_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "building_id"], [1, 1, "company_id"]]], "check_constraints": []}} | CREATE TABLE buildings (
id INT PRIMARY KEY,
name TEXT,
City TEXT,
Height INT,
Stories INT,
Status TEXT,
UNIQUE (id)
);
CREATE TABLE Companies (
id INT PRIMARY KEY,
name TEXT,
Headquarters TEXT,
Industry TEXT,
Sales_billion REAL,
Profits_billion REAL,
Assets_billion REAL,
Market_Value_billion TEXT,
UNIQUE (id)
);
CREATE TABLE Office_locations (
building_id INT PRIMARY KEY,
company_id INT PRIMARY KEY,
move_in_year INT,
PRIMARY KEY (building_id, company_id),
UNIQUE (building_id, company_id),
FOREIGN KEY (company_id) REFERENCES Companies(id),
FOREIGN KEY (building_id) REFERENCES buildings(id)
); |
game_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": []}, "Video_Games": {"columns": [[0, "GameID", "INTEGER", 0, null, 1], [1, "GName", "VARCHAR(40)", 0, null, 0], [2, "GType", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["GameID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Plays_Games": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "GameID", "INTEGER", 0, null, 0], [2, "Hours_Played", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Student", "StuID", "StuID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Video_Games", "GameID", "GameID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "SportsInfo": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "SportName", "VARCHAR(32)", 0, null, 0], [2, "HoursPerWeek", "INTEGER", 0, null, 0], [3, "GamesPlayed", "INTEGER", 0, null, 0], [4, "OnScholarship", "VARCHAR(1)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 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 Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
CREATE TABLE Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY (StuID) REFERENCES Student(StuID),
FOREIGN KEY (GameID) REFERENCES Video_Games(GameID)
);
CREATE TABLE SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY (StuID) REFERENCES Student(StuID)
); |
swimming | {"swimmer": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Nationality", "TEXT", 0, null, 0], [3, "meter_100", "REAL", 0, null, 0], [4, "meter_200", "TEXT", 0, null, 0], [5, "meter_300", "TEXT", 0, null, 0], [6, "meter_400", "TEXT", 0, null, 0], [7, "meter_500", "TEXT", 0, null, 0], [8, "meter_600", "TEXT", 0, null, 0], [9, "meter_700", "TEXT", 0, null, 0], [10, "Time", "TEXT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "stadium": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Capacity", "INT", 0, null, 0], [3, "City", "TEXT", 0, null, 0], [4, "Country", "TEXT", 0, null, 0], [5, "Opening_year", "INT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "event": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Stadium_ID", "INT", 0, null, 0], [3, "Year", "TEXT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [[0, 0, "stadium", "Stadium_ID", "ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "record": {"columns": [[0, "ID", "INT", 0, null, 0], [1, "Result", "TEXT", 0, null, 0], [2, "Swimmer_ID", "INT", 0, null, 1], [3, "Event_ID", "INT", 0, null, 2]], "primary_keys": ["Swimmer_ID", "Event_ID"], "foreign_keys": [[0, 0, "swimmer", "Swimmer_ID", "ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "event", "Event_ID", "ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 2, "Swimmer_ID"], [1, 3, "Event_ID"]]], "check_constraints": []}} | CREATE TABLE swimmer (
ID INT PRIMARY KEY,
name TEXT,
Nationality TEXT,
meter_100 REAL,
meter_200 TEXT,
meter_300 TEXT,
meter_400 TEXT,
meter_500 TEXT,
meter_600 TEXT,
meter_700 TEXT,
Time TEXT,
UNIQUE (ID)
);
CREATE TABLE stadium (
ID INT PRIMARY KEY,
name TEXT,
Capacity INT,
City TEXT,
Country TEXT,
Opening_year INT,
UNIQUE (ID)
);
CREATE TABLE event (
ID INT PRIMARY KEY,
Name TEXT,
Stadium_ID INT,
Year TEXT,
UNIQUE (ID),
FOREIGN KEY (Stadium_ID) REFERENCES stadium(ID)
);
CREATE TABLE record (
ID INT,
Result TEXT,
Swimmer_ID INT PRIMARY KEY,
Event_ID INT PRIMARY KEY,
PRIMARY KEY (Swimmer_ID, Event_ID),
UNIQUE (Swimmer_ID, Event_ID),
FOREIGN KEY (Swimmer_ID) REFERENCES swimmer(ID),
FOREIGN KEY (Event_ID) REFERENCES event(ID)
); |
local_govt_and_lot | {"Customers": {"columns": [[0, "customer_id", "INTEGER", 1, null, 1], [1, "customer_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Properties": {"columns": [[0, "property_id", "INTEGER", 1, null, 1], [1, "property_type_code", "CHAR(15)", 1, null, 0], [2, "property_address", "VARCHAR(255)", 0, null, 0], [3, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["property_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Residents": {"columns": [[0, "resident_id", "INTEGER", 1, null, 1], [1, "property_id", "INTEGER", 1, null, 2], [2, "date_moved_in", "DATETIME", 1, null, 3], [3, "date_moved_out", "DATETIME", 1, null, 0], [4, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["resident_id", "property_id", "date_moved_in"], "foreign_keys": [[0, 0, "Properties", "property_id", "property_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "resident_id"], [1, 1, "property_id"], [2, 2, "date_moved_in"]]], "check_constraints": []}, "Organizations": {"columns": [[0, "organization_id", "INTEGER", 1, null, 1], [1, "parent_organization_id", "INTEGER", 0, null, 0], [2, "organization_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["organization_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Services": {"columns": [[0, "service_id", "INTEGER", 1, null, 1], [1, "organization_id", "INTEGER", 1, null, 0], [2, "service_type_code", "CHAR(15)", 1, null, 0], [3, "service_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["service_id"], "foreign_keys": [[0, 0, "Organizations", "organization_id", "organization_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Residents_Services": {"columns": [[0, "resident_id", "INTEGER", 1, null, 1], [1, "service_id", "INTEGER", 1, null, 2], [2, "date_moved_in", "DATETIME", 0, null, 0], [3, "property_id", "INTEGER", 0, null, 0], [4, "date_requested", "DATETIME", 0, null, 0], [5, "date_provided", "DATETIME", 0, null, 0], [6, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["resident_id", "service_id"], "foreign_keys": [[0, 0, "Residents", "resident_id", "resident_id", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Residents", "property_id", "property_id", "NO ACTION", "NO ACTION", "NONE"], [0, 2, "Residents", "date_moved_in", "date_moved_in", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Services", "service_id", "service_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "resident_id"], [1, 1, "service_id"]]], "check_constraints": []}, "Things": {"columns": [[0, "thing_id", "INTEGER", 1, null, 1], [1, "organization_id", "INTEGER", 1, null, 0], [2, "Type_of_Thing_Code", "CHAR(15)", 1, null, 0], [3, "service_type_code", "CHAR(10)", 1, null, 0], [4, "service_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["thing_id"], "foreign_keys": [[0, 0, "Organizations", "organization_id", "organization_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Events": {"columns": [[0, "Customer_Event_ID", "INTEGER", 1, null, 1], [1, "customer_id", "INTEGER", 0, null, 0], [2, "date_moved_in", "DATETIME", 0, null, 0], [3, "property_id", "INTEGER", 0, null, 0], [4, "resident_id", "INTEGER", 0, null, 0], [5, "thing_id", "INTEGER", 1, null, 0]], "primary_keys": ["Customer_Event_ID"], "foreign_keys": [[0, 0, "Residents", "resident_id", "resident_id", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Residents", "property_id", "property_id", "NO ACTION", "NO ACTION", "NONE"], [0, 2, "Residents", "date_moved_in", "date_moved_in", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Things", "thing_id", "thing_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Customer_Event_Notes": {"columns": [[0, "Customer_Event_Note_ID", "INTEGER", 1, null, 1], [1, "Customer_Event_ID", "INTEGER", 1, null, 0], [2, "service_type_code", "CHAR(15)", 1, null, 0], [3, "resident_id", "INTEGER", 1, null, 0], [4, "property_id", "INTEGER", 1, null, 0], [5, "date_moved_in", "DATETIME", 1, null, 0]], "primary_keys": ["Customer_Event_Note_ID"], "foreign_keys": [[0, 0, "Customer_Events", "Customer_Event_ID", "Customer_Event_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Timed_Status_of_Things": {"columns": [[0, "thing_id", "INTEGER", 1, null, 1], [1, "Date_and_Date", "DATETIME", 1, null, 2], [2, "Status_of_Thing_Code", "CHAR(15)", 1, null, 3]], "primary_keys": ["thing_id", "Date_and_Date", "Status_of_Thing_Code"], "foreign_keys": [[0, 0, "Things", "thing_id", "thing_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "thing_id"], [1, 1, "Date_and_Date"], [2, 2, "Status_of_Thing_Code"]]], "check_constraints": []}, "Timed_Locations_of_Things": {"columns": [[0, "thing_id", "INTEGER", 1, null, 1], [1, "Date_and_Time", "DATETIME", 1, null, 2], [2, "Location_Code", "CHAR(15)", 1, null, 3]], "primary_keys": ["thing_id", "Date_and_Time", "Location_Code"], "foreign_keys": [[0, 0, "Things", "thing_id", "thing_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "thing_id"], [1, 1, "Date_and_Time"], [2, 2, "Location_Code"]]], "check_constraints": []}} | CREATE TABLE Customers (
customer_id INTEGER NOT NULL PRIMARY KEY,
customer_details VARCHAR(255)
);
CREATE TABLE Properties (
property_id INTEGER NOT NULL PRIMARY KEY,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255)
);
CREATE TABLE Residents (
resident_id INTEGER NOT NULL PRIMARY KEY,
property_id INTEGER NOT NULL PRIMARY KEY,
date_moved_in DATETIME NOT NULL PRIMARY KEY,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
UNIQUE (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties(property_id)
);
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL PRIMARY KEY,
parent_organization_id INTEGER,
organization_details VARCHAR(255)
);
CREATE TABLE Services (
service_id INTEGER NOT NULL PRIMARY KEY,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
FOREIGN KEY (organization_id) REFERENCES Organizations(organization_id)
);
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL PRIMARY KEY,
service_id INTEGER NOT NULL PRIMARY KEY,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
UNIQUE (resident_id, service_id),
FOREIGN KEY (resident_id) REFERENCES Residents(resident_id),
FOREIGN KEY (property_id) REFERENCES Residents(property_id),
FOREIGN KEY (date_moved_in) REFERENCES Residents(date_moved_in),
FOREIGN KEY (service_id) REFERENCES Services(service_id)
);
CREATE TABLE Things (
thing_id INTEGER NOT NULL PRIMARY KEY,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
FOREIGN KEY (organization_id) REFERENCES Organizations(organization_id)
);
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL PRIMARY KEY,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
FOREIGN KEY (resident_id) REFERENCES Residents(resident_id),
FOREIGN KEY (property_id) REFERENCES Residents(property_id),
FOREIGN KEY (date_moved_in) REFERENCES Residents(date_moved_in),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (thing_id) REFERENCES Things(thing_id)
);
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL PRIMARY KEY,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events(Customer_Event_ID)
);
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL PRIMARY KEY,
Date_and_Date DATETIME NOT NULL PRIMARY KEY,
Status_of_Thing_Code CHAR(15) NOT NULL PRIMARY KEY,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
UNIQUE (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things(thing_id)
);
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL PRIMARY KEY,
Date_and_Time DATETIME NOT NULL PRIMARY KEY,
Location_Code CHAR(15) NOT NULL PRIMARY KEY,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
UNIQUE (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things(thing_id)
); |
customers_campaigns_ecommerce | {"Premises": {"columns": [[0, "premise_id", "INTEGER", 0, null, 1], [1, "premises_type", "VARCHAR(15)", 1, null, 0], [2, "premise_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["premise_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_category", "VARCHAR(15)", 1, null, 0], [2, "product_name", "VARCHAR(80)", 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, "customer_phone", "VARCHAR(80)", 0, null, 0], [4, "customer_email", "VARCHAR(80)", 0, null, 0], [5, "customer_address", "VARCHAR(255)", 0, null, 0], [6, "customer_login", "VARCHAR(80)", 0, null, 0], [7, "customer_password", "VARCHAR(10)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Mailshot_Campaigns": {"columns": [[0, "mailshot_id", "INTEGER", 0, null, 1], [1, "product_category", "VARCHAR(15)", 0, null, 0], [2, "mailshot_name", "VARCHAR(80)", 0, null, 0], [3, "mailshot_start_date", "DATETIME", 0, null, 0], [4, "mailshot_end_date", "DATETIME", 0, null, 0]], "primary_keys": ["mailshot_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 0], [1, "premise_id", "INTEGER", 1, null, 0], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "address_type_code", "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, "Premises", "premise_id", "premise_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_code", "VARCHAR(15)", 1, null, 0], [3, "shipping_method_code", "VARCHAR(15)", 1, null, 0], [4, "order_placed_datetime", "DATETIME", 1, null, 0], [5, "order_delivered_datetime", "DATETIME", 0, null, 0], [6, "order_shipping_charges", "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": []}, "Mailshot_Customers": {"columns": [[0, "mailshot_id", "INTEGER", 1, null, 0], [1, "customer_id", "INTEGER", 1, null, 0], [2, "outcome_code", "VARCHAR(15)", 1, null, 0], [3, "mailshot_customer_date", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Mailshot_Campaigns", "mailshot_id", "mailshot_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "item_id", "INTEGER", 1, null, 0], [1, "order_item_status_code", "VARCHAR(15)", 1, null, 0], [2, "order_id", "INTEGER", 1, null, 0], [3, "product_id", "INTEGER", 1, null, 0], [4, "item_status_code", "VARCHAR(15)", 0, null, 0], [5, "item_delivered_datetime", "DATETIME", 0, null, 0], [6, "item_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 Premises (
premise_id INTEGER PRIMARY KEY,
premises_type VARCHAR(15) NOT NULL,
premise_details VARCHAR(255)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_category VARCHAR(15) NOT NULL,
product_name VARCHAR(80)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
payment_method VARCHAR(15) NOT NULL,
customer_name VARCHAR(80),
customer_phone VARCHAR(80),
customer_email VARCHAR(80),
customer_address VARCHAR(255),
customer_login VARCHAR(80),
customer_password VARCHAR(10)
);
CREATE TABLE Mailshot_Campaigns (
mailshot_id INTEGER PRIMARY KEY,
product_category VARCHAR(15),
mailshot_name VARCHAR(80),
mailshot_start_date DATETIME,
mailshot_end_date DATETIME
);
CREATE TABLE Customer_Addresses (
customer_id INTEGER NOT NULL,
premise_id INTEGER NOT NULL,
date_address_from DATETIME NOT NULL,
address_type_code VARCHAR(15) NOT NULL,
date_address_to DATETIME,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (premise_id) REFERENCES Premises(premise_id)
);
CREATE TABLE Customer_Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_status_code VARCHAR(15) NOT NULL,
shipping_method_code VARCHAR(15) NOT NULL,
order_placed_datetime DATETIME NOT NULL,
order_delivered_datetime DATETIME,
order_shipping_charges VARCHAR(255),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Mailshot_Customers (
mailshot_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
outcome_code VARCHAR(15) NOT NULL,
mailshot_customer_date DATETIME,
FOREIGN KEY (mailshot_id) REFERENCES Mailshot_Campaigns(mailshot_id),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Order_Items (
item_id INTEGER NOT NULL,
order_item_status_code VARCHAR(15) NOT NULL,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
item_status_code VARCHAR(15),
item_delivered_datetime DATETIME,
item_order_quantity VARCHAR(80),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
); |
document_management | {"Roles": {"columns": [[0, "role_code", "VARCHAR(15)", 0, null, 1], [1, "role_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["role_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "role_code"]]], "check_constraints": []}, "Users": {"columns": [[0, "user_id", "INTEGER", 0, null, 1], [1, "role_code", "VARCHAR(15)", 1, null, 0], [2, "user_name", "VARCHAR(40)", 0, null, 0], [3, "user_login", "VARCHAR(40)", 0, null, 0], [4, "password", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["user_id"], "foreign_keys": [[0, 0, "Roles", "role_code", "role_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Document_Structures": {"columns": [[0, "document_structure_code", "VARCHAR(15)", 0, null, 1], [1, "parent_document_structure_code", "VARCHAR(15)", 0, null, 0], [2, "document_structure_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["document_structure_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "document_structure_code"]]], "check_constraints": []}, "Functional_Areas": {"columns": [[0, "functional_area_code", "VARCHAR(15)", 0, null, 1], [1, "parent_functional_area_code", "VARCHAR(15)", 0, null, 0], [2, "functional_area_description", "VARCHAR(80)", 1, null, 0]], "primary_keys": ["functional_area_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "functional_area_code"]]], "check_constraints": []}, "Images": {"columns": [[0, "image_id", "INTEGER", 0, null, 1], [1, "image_alt_text", "VARCHAR(80)", 0, null, 0], [2, "image_name", "VARCHAR(40)", 0, null, 0], [3, "image_url", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["image_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Documents": {"columns": [[0, "document_code", "VARCHAR(15)", 0, null, 1], [1, "document_structure_code", "VARCHAR(15)", 1, null, 0], [2, "document_type_code", "VARCHAR(15)", 1, null, 0], [3, "access_count", "INTEGER", 0, null, 0], [4, "document_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["document_code"], "foreign_keys": [[0, 0, "Document_Structures", "document_structure_code", "document_structure_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "document_code"]]], "check_constraints": []}, "Document_Functional_Areas": {"columns": [[0, "document_code", "VARCHAR(15)", 1, null, 0], [1, "functional_area_code", "VARCHAR(15)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Functional_Areas", "functional_area_code", "functional_area_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Documents", "document_code", "document_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Document_Sections": {"columns": [[0, "section_id", "INTEGER", 0, null, 1], [1, "document_code", "VARCHAR(15)", 1, null, 0], [2, "section_sequence", "INTEGER", 0, null, 0], [3, "section_code", "VARCHAR(20)", 0, null, 0], [4, "section_title", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["section_id"], "foreign_keys": [[0, 0, "Documents", "document_code", "document_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Document_Sections_Images": {"columns": [[0, "section_id", "INTEGER", 1, null, 1], [1, "image_id", "INTEGER", 1, null, 2]], "primary_keys": ["section_id", "image_id"], "foreign_keys": [[0, 0, "Images", "image_id", "image_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Document_Sections", "section_id", "section_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "section_id"], [1, 1, "image_id"]]], "check_constraints": []}} | CREATE TABLE Roles (
role_code VARCHAR(15) PRIMARY KEY,
role_description VARCHAR(80),
UNIQUE (role_code)
);
CREATE TABLE Users (
user_id INTEGER PRIMARY KEY,
role_code VARCHAR(15) NOT NULL,
user_name VARCHAR(40),
user_login VARCHAR(40),
password VARCHAR(40),
FOREIGN KEY (role_code) REFERENCES Roles(role_code)
);
CREATE TABLE Document_Structures (
document_structure_code VARCHAR(15) PRIMARY KEY,
parent_document_structure_code VARCHAR(15),
document_structure_description VARCHAR(80),
UNIQUE (document_structure_code)
);
CREATE TABLE Functional_Areas (
functional_area_code VARCHAR(15) PRIMARY KEY,
parent_functional_area_code VARCHAR(15),
functional_area_description VARCHAR(80) NOT NULL,
UNIQUE (functional_area_code)
);
CREATE TABLE Images (
image_id INTEGER PRIMARY KEY,
image_alt_text VARCHAR(80),
image_name VARCHAR(40),
image_url VARCHAR(255)
);
CREATE TABLE Documents (
document_code VARCHAR(15) PRIMARY KEY,
document_structure_code VARCHAR(15) NOT NULL,
document_type_code VARCHAR(15) NOT NULL,
access_count INTEGER,
document_name VARCHAR(80),
UNIQUE (document_code),
FOREIGN KEY (document_structure_code) REFERENCES Document_Structures(document_structure_code)
);
CREATE TABLE Document_Functional_Areas (
document_code VARCHAR(15) NOT NULL,
functional_area_code VARCHAR(15) NOT NULL,
FOREIGN KEY (functional_area_code) REFERENCES Functional_Areas(functional_area_code),
FOREIGN KEY (document_code) REFERENCES Documents(document_code)
);
CREATE TABLE Document_Sections (
section_id INTEGER PRIMARY KEY,
document_code VARCHAR(15) NOT NULL,
section_sequence INTEGER,
section_code VARCHAR(20),
section_title VARCHAR(80),
FOREIGN KEY (document_code) REFERENCES Documents(document_code)
);
CREATE TABLE Document_Sections_Images (
section_id INTEGER NOT NULL PRIMARY KEY,
image_id INTEGER NOT NULL PRIMARY KEY,
PRIMARY KEY (section_id, image_id),
UNIQUE (section_id, image_id),
FOREIGN KEY (image_id) REFERENCES Images(image_id),
FOREIGN KEY (section_id) REFERENCES Document_Sections(section_id)
); |
party_people | {"region": {"columns": [[0, "Region_ID", "INT", 0, null, 1], [1, "Region_name", "TEXT", 0, null, 0], [2, "Date", "TEXT", 0, null, 0], [3, "Label", "TEXT", 0, null, 0], [4, "Format", "TEXT", 0, null, 0], [5, "Catalogue", "TEXT", 0, null, 0]], "primary_keys": ["Region_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Region_ID"]]], "check_constraints": []}, "party": {"columns": [[0, "Party_ID", "INT", 0, null, 1], [1, "Minister", "TEXT", 0, null, 0], [2, "Took_office", "TEXT", 0, null, 0], [3, "Left_office", "TEXT", 0, null, 0], [4, "Region_ID", "INT", 0, null, 0], [5, "Party_name", "TEXT", 0, null, 0]], "primary_keys": ["Party_ID"], "foreign_keys": [[0, 0, "region", "Region_ID", "Region_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Party_ID"]]], "check_constraints": []}, "member": {"columns": [[0, "Member_ID", "INT", 0, null, 1], [1, "Member_Name", "TEXT", 0, null, 0], [2, "Party_ID", "TEXT", 0, null, 0], [3, "In_office", "TEXT", 0, null, 0]], "primary_keys": ["Member_ID"], "foreign_keys": [[0, 0, "party", "Party_ID", "Party_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Member_ID"]]], "check_constraints": []}, "party_events": {"columns": [[0, "Event_ID", "INT", 0, null, 1], [1, "Event_Name", "TEXT", 0, null, 0], [2, "Party_ID", "INT", 0, null, 0], [3, "Member_in_charge_ID", "INT", 0, null, 0]], "primary_keys": ["Event_ID"], "foreign_keys": [[0, 0, "member", "Member_in_charge_ID", "Member_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "party", "Party_ID", "Party_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Event_ID"]]], "check_constraints": []}} | CREATE TABLE region (
Region_ID INT PRIMARY KEY,
Region_name TEXT,
Date TEXT,
Label TEXT,
Format TEXT,
Catalogue TEXT,
UNIQUE (Region_ID)
);
CREATE TABLE party (
Party_ID INT PRIMARY KEY,
Minister TEXT,
Took_office TEXT,
Left_office TEXT,
Region_ID INT,
Party_name TEXT,
UNIQUE (Party_ID),
FOREIGN KEY (Region_ID) REFERENCES region(Region_ID)
);
CREATE TABLE member (
Member_ID INT PRIMARY KEY,
Member_Name TEXT,
Party_ID TEXT,
In_office TEXT,
UNIQUE (Member_ID),
FOREIGN KEY (Party_ID) REFERENCES party(Party_ID)
);
CREATE TABLE party_events (
Event_ID INT PRIMARY KEY,
Event_Name TEXT,
Party_ID INT,
Member_in_charge_ID INT,
UNIQUE (Event_ID),
FOREIGN KEY (Member_in_charge_ID) REFERENCES member(Member_ID),
FOREIGN KEY (Party_ID) REFERENCES party(Party_ID)
); |
products_gen_characteristics | {"Ref_Characteristic_Types": {"columns": [[0, "characteristic_type_code", "VARCHAR(15)", 0, null, 1], [1, "characteristic_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["characteristic_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "characteristic_type_code"]]], "check_constraints": []}, "Ref_Colors": {"columns": [[0, "color_code", "VARCHAR(15)", 0, null, 1], [1, "color_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["color_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "color_code"]]], "check_constraints": []}, "Ref_Product_Categories": {"columns": [[0, "product_category_code", "VARCHAR(15)", 0, null, 1], [1, "product_category_description", "VARCHAR(80)", 0, null, 0], [2, "unit_of_measure", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["product_category_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "product_category_code"]]], "check_constraints": []}, "Characteristics": {"columns": [[0, "characteristic_id", "INTEGER", 0, null, 1], [1, "characteristic_type_code", "VARCHAR(15)", 1, null, 0], [2, "characteristic_data_type", "VARCHAR(10)", 0, null, 0], [3, "characteristic_name", "VARCHAR(80)", 0, null, 0], [4, "other_characteristic_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["characteristic_id"], "foreign_keys": [[0, 0, "Ref_Characteristic_Types", "characteristic_type_code", "characteristic_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "color_code", "VARCHAR(15)", 1, null, 0], [2, "product_category_code", "VARCHAR(15)", 1, null, 0], [3, "product_name", "VARCHAR(80)", 0, null, 0], [4, "typical_buying_price", "VARCHAR(20)", 0, null, 0], [5, "typical_selling_price", "VARCHAR(20)", 0, null, 0], [6, "product_description", "VARCHAR(255)", 0, null, 0], [7, "other_product_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [[0, 0, "Ref_Colors", "color_code", "color_code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Product_Categories", "product_category_code", "product_category_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Product_Characteristics": {"columns": [[0, "product_id", "INTEGER", 1, null, 0], [1, "characteristic_id", "INTEGER", 1, null, 0], [2, "product_characteristic_value", "VARCHAR(50)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Characteristics", "characteristic_id", "characteristic_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Characteristic_Types (
characteristic_type_code VARCHAR(15) PRIMARY KEY,
characteristic_type_description VARCHAR(80),
UNIQUE (characteristic_type_code)
);
CREATE TABLE Ref_Colors (
color_code VARCHAR(15) PRIMARY KEY,
color_description VARCHAR(80),
UNIQUE (color_code)
);
CREATE TABLE Ref_Product_Categories (
product_category_code VARCHAR(15) PRIMARY KEY,
product_category_description VARCHAR(80),
unit_of_measure VARCHAR(20),
UNIQUE (product_category_code)
);
CREATE TABLE Characteristics (
characteristic_id INTEGER PRIMARY KEY,
characteristic_type_code VARCHAR(15) NOT NULL,
characteristic_data_type VARCHAR(10),
characteristic_name VARCHAR(80),
other_characteristic_details VARCHAR(255),
FOREIGN KEY (characteristic_type_code) REFERENCES Ref_Characteristic_Types(characteristic_type_code)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
color_code VARCHAR(15) NOT NULL,
product_category_code VARCHAR(15) NOT NULL,
product_name VARCHAR(80),
typical_buying_price VARCHAR(20),
typical_selling_price VARCHAR(20),
product_description VARCHAR(255),
other_product_details VARCHAR(255),
FOREIGN KEY (color_code) REFERENCES Ref_Colors(color_code),
FOREIGN KEY (product_category_code) REFERENCES Ref_Product_Categories(product_category_code)
);
CREATE TABLE Product_Characteristics (
product_id INTEGER NOT NULL,
characteristic_id INTEGER NOT NULL,
product_characteristic_value VARCHAR(50),
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (characteristic_id) REFERENCES Characteristics(characteristic_id)
); |
cre_Doc_Template_Mgt | {"Ref_Template_Types": {"columns": [[0, "Template_Type_Code", "CHAR(15)", 1, null, 1], [1, "Template_Type_Description", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Template_Type_Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Template_Type_Code"]]], "check_constraints": []}, "Templates": {"columns": [[0, "Template_ID", "INTEGER", 1, null, 1], [1, "Version_Number", "INTEGER", 1, null, 0], [2, "Template_Type_Code", "CHAR(15)", 1, null, 0], [3, "Date_Effective_From", "DATETIME", 0, null, 0], [4, "Date_Effective_To", "DATETIME", 0, null, 0], [5, "Template_Details", "VARCHAR(255)", 1, null, 0]], "primary_keys": ["Template_ID"], "foreign_keys": [[0, 0, "Ref_Template_Types", "Template_Type_Code", "Template_Type_Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Documents": {"columns": [[0, "Document_ID", "INTEGER", 1, null, 1], [1, "Template_ID", "INTEGER", 0, null, 0], [2, "Document_Name", "VARCHAR(255)", 0, null, 0], [3, "Document_Description", "VARCHAR(255)", 0, null, 0], [4, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Document_ID"], "foreign_keys": [[0, 0, "Templates", "Template_ID", "Template_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Paragraphs": {"columns": [[0, "Paragraph_ID", "INTEGER", 1, null, 1], [1, "Document_ID", "INTEGER", 1, null, 0], [2, "Paragraph_Text", "VARCHAR(255)", 0, null, 0], [3, "Other_Details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Paragraph_ID"], "foreign_keys": [[0, 0, "Documents", "Document_ID", "Document_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Template_Types (
Template_Type_Code CHAR(15) NOT NULL PRIMARY KEY,
Template_Type_Description VARCHAR(255) NOT NULL,
UNIQUE (Template_Type_Code)
);
CREATE TABLE Templates (
Template_ID INTEGER NOT NULL PRIMARY KEY,
Version_Number INTEGER NOT NULL,
Template_Type_Code CHAR(15) NOT NULL,
Date_Effective_From DATETIME,
Date_Effective_To DATETIME,
Template_Details VARCHAR(255) NOT NULL,
FOREIGN KEY (Template_Type_Code) REFERENCES Ref_Template_Types(Template_Type_Code)
);
CREATE TABLE Documents (
Document_ID INTEGER NOT NULL PRIMARY KEY,
Template_ID INTEGER,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255),
FOREIGN KEY (Template_ID) REFERENCES Templates(Template_ID)
);
CREATE TABLE Paragraphs (
Paragraph_ID INTEGER NOT NULL PRIMARY KEY,
Document_ID INTEGER NOT NULL,
Paragraph_Text VARCHAR(255),
Other_Details VARCHAR(255),
FOREIGN KEY (Document_ID) REFERENCES Documents(Document_ID)
); |
scientist_1 | {"Scientists": {"columns": [[0, "SSN", "INT", 0, null, 1], [1, "Name", "Char(30)", 1, null, 0]], "primary_keys": ["SSN"], "foreign_keys": [], "unique_constraints": [[[0, 0, "SSN"]]], "check_constraints": []}, "Projects": {"columns": [[0, "Code", "Char(4)", 0, null, 1], [1, "Name", "Char(50)", 1, null, 0], [2, "Hours", "INT", 0, null, 0]], "primary_keys": ["Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Code"]]], "check_constraints": []}, "AssignedTo": {"columns": [[0, "Scientist", "INT", 1, null, 1], [1, "Project", "char(4)", 1, null, 2]], "primary_keys": ["Scientist", "Project"], "foreign_keys": [[0, 0, "Projects", "Project", "Code", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Scientists", "Scientist", "SSN", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Scientist"], [1, 1, "Project"]]], "check_constraints": []}} | CREATE TABLE Scientists (
SSN INT PRIMARY KEY,
Name Char(30) NOT NULL,
UNIQUE (SSN)
);
CREATE TABLE Projects (
Code Char(4) PRIMARY KEY,
Name Char(50) NOT NULL,
Hours INT,
UNIQUE (Code)
);
CREATE TABLE AssignedTo (
Scientist INT NOT NULL PRIMARY KEY,
Project char(4) NOT NULL PRIMARY KEY,
PRIMARY KEY (Scientist, Project),
UNIQUE (Scientist, Project),
FOREIGN KEY (Project) REFERENCES Projects(Code),
FOREIGN KEY (Scientist) REFERENCES Scientists(SSN)
); |
workshop_paper | {"workshop": {"columns": [[0, "Workshop_ID", "INT", 0, null, 1], [1, "Date", "TEXT", 0, null, 0], [2, "Venue", "TEXT", 0, null, 0], [3, "Name", "TEXT", 0, null, 0]], "primary_keys": ["Workshop_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Workshop_ID"]]], "check_constraints": []}, "submission": {"columns": [[0, "Submission_ID", "INT", 0, null, 1], [1, "Scores", "REAL", 0, null, 0], [2, "Author", "TEXT", 0, null, 0], [3, "College", "TEXT", 0, null, 0]], "primary_keys": ["Submission_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Submission_ID"]]], "check_constraints": []}, "Acceptance": {"columns": [[0, "Submission_ID", "INT", 0, null, 1], [1, "Workshop_ID", "INT", 0, null, 2], [2, "Result", "TEXT", 0, null, 0]], "primary_keys": ["Submission_ID", "Workshop_ID"], "foreign_keys": [[0, 0, "workshop", "Workshop_ID", "Workshop_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "submission", "Submission_ID", "Submission_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Submission_ID"], [1, 1, "Workshop_ID"]]], "check_constraints": []}} | CREATE TABLE workshop (
Workshop_ID INT PRIMARY KEY,
Date TEXT,
Venue TEXT,
Name TEXT,
UNIQUE (Workshop_ID)
);
CREATE TABLE submission (
Submission_ID INT PRIMARY KEY,
Scores REAL,
Author TEXT,
College TEXT,
UNIQUE (Submission_ID)
);
CREATE TABLE Acceptance (
Submission_ID INT PRIMARY KEY,
Workshop_ID INT PRIMARY KEY,
Result TEXT,
PRIMARY KEY (Submission_ID, Workshop_ID),
UNIQUE (Submission_ID, Workshop_ID),
FOREIGN KEY (Workshop_ID) REFERENCES workshop(Workshop_ID),
FOREIGN KEY (Submission_ID) REFERENCES submission(Submission_ID)
); |
apartment_rentals | {"Apartment_Buildings": {"columns": [[0, "building_id", "INTEGER", 1, null, 1], [1, "building_short_name", "CHAR(15)", 0, null, 0], [2, "building_full_name", "VARCHAR(80)", 0, null, 0], [3, "building_description", "VARCHAR(255)", 0, null, 0], [4, "building_address", "VARCHAR(255)", 0, null, 0], [5, "building_manager", "VARCHAR(50)", 0, null, 0], [6, "building_phone", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["building_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "building_id"]]], "check_constraints": []}, "Apartments": {"columns": [[0, "apt_id", "INTEGER", 1, null, 1], [1, "building_id", "INTEGER", 1, null, 0], [2, "apt_type_code", "CHAR(15)", 0, null, 0], [3, "apt_number", "CHAR(10)", 0, null, 0], [4, "bathroom_count", "INTEGER", 0, null, 0], [5, "bedroom_count", "INTEGER", 0, null, 0], [6, "room_count", "CHAR(5)", 0, null, 0]], "primary_keys": ["apt_id"], "foreign_keys": [[0, 0, "Apartment_Buildings", "building_id", "building_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "apt_id"]]], "check_constraints": []}, "Apartment_Facilities": {"columns": [[0, "apt_id", "INTEGER", 1, null, 1], [1, "facility_code", "CHAR(15)", 1, null, 2]], "primary_keys": ["apt_id", "facility_code"], "foreign_keys": [[0, 0, "Apartments", "apt_id", "apt_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "apt_id"], [1, 1, "facility_code"]]], "check_constraints": []}, "Guests": {"columns": [[0, "guest_id", "INTEGER", 1, null, 1], [1, "gender_code", "CHAR(1)", 0, null, 0], [2, "guest_first_name", "VARCHAR(80)", 0, null, 0], [3, "guest_last_name", "VARCHAR(80)", 0, null, 0], [4, "date_of_birth", "DATETIME", 0, null, 0]], "primary_keys": ["guest_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "guest_id"]]], "check_constraints": []}, "Apartment_Bookings": {"columns": [[0, "apt_booking_id", "INTEGER", 1, null, 1], [1, "apt_id", "INTEGER", 0, null, 0], [2, "guest_id", "INTEGER", 1, null, 0], [3, "booking_status_code", "CHAR(15)", 1, null, 0], [4, "booking_start_date", "DATETIME", 0, null, 0], [5, "booking_end_date", "DATETIME", 0, null, 0]], "primary_keys": ["apt_booking_id"], "foreign_keys": [[0, 0, "Guests", "guest_id", "guest_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Apartments", "apt_id", "apt_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "apt_booking_id"]]], "check_constraints": []}, "View_Unit_Status": {"columns": [[0, "apt_id", "INTEGER", 0, null, 0], [1, "apt_booking_id", "INTEGER", 0, null, 0], [2, "status_date", "DATETIME", 1, null, 1], [3, "available_yn", "BIT", 0, null, 0]], "primary_keys": ["status_date"], "foreign_keys": [[0, 0, "Apartment_Bookings", "apt_booking_id", "apt_booking_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Apartments", "apt_id", "apt_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 2, "status_date"]]], "check_constraints": []}} | CREATE TABLE Apartment_Buildings (
building_id INTEGER NOT NULL PRIMARY KEY,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80),
UNIQUE (building_id)
);
CREATE TABLE Apartments (
apt_id INTEGER NOT NULL PRIMARY KEY,
building_id INTEGER NOT NULL,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5),
UNIQUE (apt_id),
FOREIGN KEY (building_id) REFERENCES Apartment_Buildings(building_id)
);
CREATE TABLE Apartment_Facilities (
apt_id INTEGER NOT NULL PRIMARY KEY,
facility_code CHAR(15) NOT NULL PRIMARY KEY,
PRIMARY KEY (apt_id, facility_code),
UNIQUE (apt_id, facility_code),
FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)
);
CREATE TABLE Guests (
guest_id INTEGER NOT NULL PRIMARY KEY,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME,
UNIQUE (guest_id)
);
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER NOT NULL PRIMARY KEY,
apt_id INTEGER,
guest_id INTEGER NOT NULL,
booking_status_code CHAR(15) NOT NULL,
booking_start_date DATETIME,
booking_end_date DATETIME,
UNIQUE (apt_booking_id),
FOREIGN KEY (guest_id) REFERENCES Guests(guest_id),
FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)
);
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME NOT NULL PRIMARY KEY,
available_yn BIT,
UNIQUE (status_date),
FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings(apt_booking_id),
FOREIGN KEY (apt_id) REFERENCES Apartments(apt_id)
); |
department_store | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Staff": {"columns": [[0, "staff_id", "INTEGER", 0, null, 1], [1, "staff_gender", "VARCHAR(1)", 0, null, 0], [2, "staff_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["staff_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Suppliers": {"columns": [[0, "supplier_id", "INTEGER", 0, null, 1], [1, "supplier_name", "VARCHAR(80)", 0, null, 0], [2, "supplier_phone", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["supplier_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Department_Store_Chain": {"columns": [[0, "dept_store_chain_id", "INTEGER", 0, null, 1], [1, "dept_store_chain_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["dept_store_chain_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "payment_method_code", "VARCHAR(10)", 1, null, 0], [2, "customer_code", "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": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_type_code", "VARCHAR(10)", 1, null, 0], [2, "product_name", "VARCHAR(80)", 0, null, 0], [3, "product_price", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Supplier_Addresses": {"columns": [[0, "supplier_id", "INTEGER", 1, null, 1], [1, "address_id", "INTEGER", 1, null, 2], [2, "date_from", "DATETIME", 1, null, 0], [3, "date_to", "DATETIME", 0, null, 0]], "primary_keys": ["supplier_id", "address_id"], "foreign_keys": [[0, 0, "Suppliers", "supplier_id", "supplier_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "supplier_id"], [1, 1, "address_id"]]], "check_constraints": []}, "Customer_Addresses": {"columns": [[0, "customer_id", "INTEGER", 1, null, 1], [1, "address_id", "INTEGER", 1, null, 2], [2, "date_from", "DATETIME", 1, null, 0], [3, "date_to", "DATETIME", 0, null, 0]], "primary_keys": ["customer_id", "address_id"], "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": [[[0, 0, "customer_id"], [1, 1, "address_id"]]], "check_constraints": []}, "Customer_Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "order_status_code", "VARCHAR(10)", 1, null, 0], [3, "order_date", "DATETIME", 1, null, 0]], "primary_keys": ["order_id"], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Department_Stores": {"columns": [[0, "dept_store_id", "INTEGER", 0, null, 1], [1, "dept_store_chain_id", "INTEGER", 0, null, 0], [2, "store_name", "VARCHAR(80)", 0, null, 0], [3, "store_address", "VARCHAR(255)", 0, null, 0], [4, "store_phone", "VARCHAR(80)", 0, null, 0], [5, "store_email", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["dept_store_id"], "foreign_keys": [[0, 0, "Department_Store_Chain", "dept_store_chain_id", "dept_store_chain_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Departments": {"columns": [[0, "department_id", "INTEGER", 0, null, 1], [1, "dept_store_id", "INTEGER", 1, null, 0], [2, "department_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["department_id"], "foreign_keys": [[0, 0, "Department_Stores", "dept_store_id", "dept_store_id", "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]], "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": []}, "Product_Suppliers": {"columns": [[0, "product_id", "INTEGER", 1, null, 1], [1, "supplier_id", "INTEGER", 1, null, 2], [2, "date_supplied_from", "DATETIME", 1, null, 0], [3, "date_supplied_to", "DATETIME", 0, null, 0], [4, "total_amount_purchased", "VARCHAR(80)", 0, null, 0], [5, "total_value_purchased", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["product_id", "supplier_id"], "foreign_keys": [[0, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Suppliers", "supplier_id", "supplier_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "product_id"], [1, 1, "supplier_id"]]], "check_constraints": []}, "Staff_Department_Assignments": {"columns": [[0, "staff_id", "INTEGER", 1, null, 1], [1, "department_id", "INTEGER", 1, null, 2], [2, "date_assigned_from", "DATETIME", 1, null, 0], [3, "job_title_code", "VARCHAR(10)", 1, null, 0], [4, "date_assigned_to", "DATETIME", 0, null, 0]], "primary_keys": ["staff_id", "department_id"], "foreign_keys": [[0, 0, "Staff", "staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Departments", "department_id", "department_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "staff_id"], [1, 1, "department_id"]]], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
address_details VARCHAR(255)
);
CREATE TABLE Staff (
staff_id INTEGER PRIMARY KEY,
staff_gender VARCHAR(1),
staff_name VARCHAR(80)
);
CREATE TABLE Suppliers (
supplier_id INTEGER PRIMARY KEY,
supplier_name VARCHAR(80),
supplier_phone VARCHAR(80)
);
CREATE TABLE Department_Store_Chain (
dept_store_chain_id INTEGER PRIMARY KEY,
dept_store_chain_name VARCHAR(80)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
payment_method_code VARCHAR(10) NOT NULL,
customer_code VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_type_code VARCHAR(10) NOT NULL,
product_name VARCHAR(80),
product_price DECIMAL(19,4)
);
CREATE TABLE Supplier_Addresses (
supplier_id INTEGER NOT NULL PRIMARY KEY,
address_id INTEGER NOT NULL PRIMARY KEY,
date_from DATETIME NOT NULL,
date_to DATETIME,
PRIMARY KEY (supplier_id, address_id),
UNIQUE (supplier_id, address_id),
FOREIGN KEY (supplier_id) REFERENCES Suppliers(supplier_id),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Customer_Addresses (
customer_id INTEGER NOT NULL PRIMARY KEY,
address_id INTEGER NOT NULL PRIMARY KEY,
date_from DATETIME NOT NULL,
date_to DATETIME,
PRIMARY KEY (customer_id, address_id),
UNIQUE (customer_id, address_id),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Customer_Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_status_code VARCHAR(10) NOT NULL,
order_date DATETIME NOT NULL,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Department_Stores (
dept_store_id INTEGER PRIMARY KEY,
dept_store_chain_id INTEGER,
store_name VARCHAR(80),
store_address VARCHAR(255),
store_phone VARCHAR(80),
store_email VARCHAR(80),
FOREIGN KEY (dept_store_chain_id) REFERENCES Department_Store_Chain(dept_store_chain_id)
);
CREATE TABLE Departments (
department_id INTEGER PRIMARY KEY,
dept_store_id INTEGER NOT NULL,
department_name VARCHAR(80),
FOREIGN KEY (dept_store_id) REFERENCES Department_Stores(dept_store_id)
);
CREATE TABLE Order_Items (
order_item_id INTEGER PRIMARY KEY,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Customer_Orders(order_id)
);
CREATE TABLE Product_Suppliers (
product_id INTEGER NOT NULL PRIMARY KEY,
supplier_id INTEGER NOT NULL PRIMARY KEY,
date_supplied_from DATETIME NOT NULL,
date_supplied_to DATETIME,
total_amount_purchased VARCHAR(80),
total_value_purchased DECIMAL(19,4),
PRIMARY KEY (product_id, supplier_id),
UNIQUE (product_id, supplier_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (supplier_id) REFERENCES Suppliers(supplier_id)
);
CREATE TABLE Staff_Department_Assignments (
staff_id INTEGER NOT NULL PRIMARY KEY,
department_id INTEGER NOT NULL PRIMARY KEY,
date_assigned_from DATETIME NOT NULL,
job_title_code VARCHAR(10) NOT NULL,
date_assigned_to DATETIME,
PRIMARY KEY (staff_id, department_id),
UNIQUE (staff_id, department_id),
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (department_id) REFERENCES Departments(department_id)
); |
university_basketball | {"basketball_match": {"columns": [[0, "Team_ID", "INT", 0, null, 1], [1, "School_ID", "INT", 0, null, 0], [2, "Team_Name", "TEXT", 0, null, 0], [3, "ACC_Regular_Season", "TEXT", 0, null, 0], [4, "ACC_Percent", "TEXT", 0, null, 0], [5, "ACC_Home", "TEXT", 0, null, 0], [6, "ACC_Road", "TEXT", 0, null, 0], [7, "All_Games", "TEXT", 0, null, 0], [8, "All_Games_Percent", "INT", 0, null, 0], [9, "All_Home", "TEXT", 0, null, 0], [10, "All_Road", "TEXT", 0, null, 0], [11, "All_Neutral", "TEXT", 0, null, 0]], "primary_keys": ["Team_ID"], "foreign_keys": [[0, 0, "university", "School_ID", "School_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Team_ID"]]], "check_constraints": []}, "university": {"columns": [[0, "School_ID", "INT", 0, null, 1], [1, "School", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Founded", "REAL", 0, null, 0], [4, "Affiliation", "TEXT", 0, null, 0], [5, "Enrollment", "REAL", 0, null, 0], [6, "Nickname", "TEXT", 0, null, 0], [7, "Primary_conference", "TEXT", 0, null, 0]], "primary_keys": ["School_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "School_ID"]]], "check_constraints": []}} | CREATE TABLE basketball_match (
Team_ID INT PRIMARY KEY,
School_ID INT,
Team_Name TEXT,
ACC_Regular_Season TEXT,
ACC_Percent TEXT,
ACC_Home TEXT,
ACC_Road TEXT,
All_Games TEXT,
All_Games_Percent INT,
All_Home TEXT,
All_Road TEXT,
All_Neutral TEXT,
UNIQUE (Team_ID),
FOREIGN KEY (School_ID) REFERENCES university(School_ID)
);
CREATE TABLE university (
School_ID INT PRIMARY KEY,
School TEXT,
Location TEXT,
Founded REAL,
Affiliation TEXT,
Enrollment REAL,
Nickname TEXT,
Primary_conference TEXT,
UNIQUE (School_ID)
); |
county_public_safety | {"county_public_safety": {"columns": [[0, "County_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Population", "INT", 0, null, 0], [3, "Police_officers", "INT", 0, null, 0], [4, "Residents_per_officer", "INT", 0, null, 0], [5, "Case_burden", "INT", 0, null, 0], [6, "Crime_rate", "REAL", 0, null, 0], [7, "Police_force", "TEXT", 0, null, 0], [8, "Location", "TEXT", 0, null, 0]], "primary_keys": ["County_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "County_ID"]]], "check_constraints": []}, "city": {"columns": [[0, "City_ID", "INT", 0, null, 1], [1, "County_ID", "INT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "White", "REAL", 0, null, 0], [4, "Black", "REAL", 0, null, 0], [5, "Amerindian", "REAL", 0, null, 0], [6, "Asian", "REAL", 0, null, 0], [7, "Multiracial", "REAL", 0, null, 0], [8, "Hispanic", "REAL", 0, null, 0]], "primary_keys": ["City_ID"], "foreign_keys": [[0, 0, "county_public_safety", "County_ID", "County_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "City_ID"]]], "check_constraints": []}} | CREATE TABLE county_public_safety (
County_ID INT PRIMARY KEY,
Name TEXT,
Population INT,
Police_officers INT,
Residents_per_officer INT,
Case_burden INT,
Crime_rate REAL,
Police_force TEXT,
Location TEXT,
UNIQUE (County_ID)
);
CREATE TABLE city (
City_ID INT PRIMARY KEY,
County_ID INT,
Name TEXT,
White REAL,
Black REAL,
Amerindian REAL,
Asian REAL,
Multiracial REAL,
Hispanic REAL,
UNIQUE (City_ID),
FOREIGN KEY (County_ID) REFERENCES county_public_safety(County_ID)
); |
assets_maintenance | {"Third_Party_Companies": {"columns": [[0, "company_id", "INTEGER", 0, null, 1], [1, "company_type", "VARCHAR(5)", 1, null, 0], [2, "company_name", "VARCHAR(255)", 0, null, 0], [3, "company_address", "VARCHAR(255)", 0, null, 0], [4, "other_company_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["company_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Maintenance_Contracts": {"columns": [[0, "maintenance_contract_id", "INTEGER", 0, null, 1], [1, "maintenance_contract_company_id", "INTEGER", 1, null, 0], [2, "contract_start_date", "DATETIME", 0, null, 0], [3, "contract_end_date", "DATETIME", 0, null, 0], [4, "other_contract_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["maintenance_contract_id"], "foreign_keys": [[0, 0, "Third_Party_Companies", "maintenance_contract_company_id", "company_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Parts": {"columns": [[0, "part_id", "INTEGER", 0, null, 1], [1, "part_name", "VARCHAR(255)", 0, null, 0], [2, "chargeable_yn", "VARCHAR(1)", 0, null, 0], [3, "chargeable_amount", "VARCHAR(20)", 0, null, 0], [4, "other_part_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["part_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Skills": {"columns": [[0, "skill_id", "INTEGER", 0, null, 1], [1, "skill_code", "VARCHAR(20)", 0, null, 0], [2, "skill_description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["skill_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Staff": {"columns": [[0, "staff_id", "INTEGER", 0, null, 1], [1, "staff_name", "VARCHAR(255)", 0, null, 0], [2, "gender", "VARCHAR(1)", 0, null, 0], [3, "other_staff_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["staff_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Assets": {"columns": [[0, "asset_id", "INTEGER", 0, null, 1], [1, "maintenance_contract_id", "INTEGER", 1, null, 0], [2, "supplier_company_id", "INTEGER", 1, null, 0], [3, "asset_details", "VARCHAR(255)", 0, null, 0], [4, "asset_make", "VARCHAR(20)", 0, null, 0], [5, "asset_model", "VARCHAR(20)", 0, null, 0], [6, "asset_acquired_date", "DATETIME", 0, null, 0], [7, "asset_disposed_date", "DATETIME", 0, null, 0], [8, "other_asset_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["asset_id"], "foreign_keys": [[0, 0, "Third_Party_Companies", "supplier_company_id", "company_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Maintenance_Contracts", "maintenance_contract_id", "maintenance_contract_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Asset_Parts": {"columns": [[0, "asset_id", "INTEGER", 1, null, 0], [1, "part_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Assets", "asset_id", "asset_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Parts", "part_id", "part_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Maintenance_Engineers": {"columns": [[0, "engineer_id", "INTEGER", 0, null, 1], [1, "company_id", "INTEGER", 1, null, 0], [2, "first_name", "VARCHAR(50)", 0, null, 0], [3, "last_name", "VARCHAR(50)", 0, null, 0], [4, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["engineer_id"], "foreign_keys": [[0, 0, "Third_Party_Companies", "company_id", "company_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Engineer_Skills": {"columns": [[0, "engineer_id", "INTEGER", 1, null, 0], [1, "skill_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Skills", "skill_id", "skill_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Maintenance_Engineers", "engineer_id", "engineer_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Fault_Log": {"columns": [[0, "fault_log_entry_id", "INTEGER", 0, null, 1], [1, "asset_id", "INTEGER", 1, null, 0], [2, "recorded_by_staff_id", "INTEGER", 1, null, 0], [3, "fault_log_entry_datetime", "DATETIME", 0, null, 0], [4, "fault_description", "VARCHAR(255)", 0, null, 0], [5, "other_fault_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["fault_log_entry_id"], "foreign_keys": [[0, 0, "Staff", "recorded_by_staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Assets", "asset_id", "asset_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Engineer_Visits": {"columns": [[0, "engineer_visit_id", "INTEGER", 0, null, 1], [1, "contact_staff_id", "INTEGER", 0, null, 0], [2, "engineer_id", "INTEGER", 1, null, 0], [3, "fault_log_entry_id", "INTEGER", 1, null, 0], [4, "fault_status", "VARCHAR(10)", 1, null, 0], [5, "visit_start_datetime", "DATETIME", 0, null, 0], [6, "visit_end_datetime", "DATETIME", 0, null, 0], [7, "other_visit_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["engineer_visit_id"], "foreign_keys": [[0, 0, "Staff", "contact_staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Maintenance_Engineers", "engineer_id", "engineer_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Fault_Log", "fault_log_entry_id", "fault_log_entry_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Part_Faults": {"columns": [[0, "part_fault_id", "INTEGER", 0, null, 1], [1, "part_id", "INTEGER", 1, null, 0], [2, "fault_short_name", "VARCHAR(20)", 0, null, 0], [3, "fault_description", "VARCHAR(255)", 0, null, 0], [4, "other_fault_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["part_fault_id"], "foreign_keys": [[0, 0, "Parts", "part_id", "part_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Fault_Log_Parts": {"columns": [[0, "fault_log_entry_id", "INTEGER", 1, null, 0], [1, "part_fault_id", "INTEGER", 1, null, 0], [2, "fault_status", "VARCHAR(10)", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Fault_Log", "fault_log_entry_id", "fault_log_entry_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Part_Faults", "part_fault_id", "part_fault_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Skills_Required_To_Fix": {"columns": [[0, "part_fault_id", "INTEGER", 1, null, 0], [1, "skill_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Skills", "skill_id", "skill_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Part_Faults", "part_fault_id", "part_fault_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Third_Party_Companies (
company_id INTEGER PRIMARY KEY,
company_type VARCHAR(5) NOT NULL,
company_name VARCHAR(255),
company_address VARCHAR(255),
other_company_details VARCHAR(255)
);
CREATE TABLE Maintenance_Contracts (
maintenance_contract_id INTEGER PRIMARY KEY,
maintenance_contract_company_id INTEGER NOT NULL,
contract_start_date DATETIME,
contract_end_date DATETIME,
other_contract_details VARCHAR(255),
FOREIGN KEY (maintenance_contract_company_id) REFERENCES Third_Party_Companies(company_id)
);
CREATE TABLE Parts (
part_id INTEGER PRIMARY KEY,
part_name VARCHAR(255),
chargeable_yn VARCHAR(1),
chargeable_amount VARCHAR(20),
other_part_details VARCHAR(255)
);
CREATE TABLE Skills (
skill_id INTEGER PRIMARY KEY,
skill_code VARCHAR(20),
skill_description VARCHAR(255)
);
CREATE TABLE Staff (
staff_id INTEGER PRIMARY KEY,
staff_name VARCHAR(255),
gender VARCHAR(1),
other_staff_details VARCHAR(255)
);
CREATE TABLE Assets (
asset_id INTEGER PRIMARY KEY,
maintenance_contract_id INTEGER NOT NULL,
supplier_company_id INTEGER NOT NULL,
asset_details VARCHAR(255),
asset_make VARCHAR(20),
asset_model VARCHAR(20),
asset_acquired_date DATETIME,
asset_disposed_date DATETIME,
other_asset_details VARCHAR(255),
FOREIGN KEY (supplier_company_id) REFERENCES Third_Party_Companies(company_id),
FOREIGN KEY (maintenance_contract_id) REFERENCES Maintenance_Contracts(maintenance_contract_id)
);
CREATE TABLE Asset_Parts (
asset_id INTEGER NOT NULL,
part_id INTEGER NOT NULL,
FOREIGN KEY (asset_id) REFERENCES Assets(asset_id),
FOREIGN KEY (part_id) REFERENCES Parts(part_id)
);
CREATE TABLE Maintenance_Engineers (
engineer_id INTEGER PRIMARY KEY,
company_id INTEGER NOT NULL,
first_name VARCHAR(50),
last_name VARCHAR(50),
other_details VARCHAR(255),
FOREIGN KEY (company_id) REFERENCES Third_Party_Companies(company_id)
);
CREATE TABLE Engineer_Skills (
engineer_id INTEGER NOT NULL,
skill_id INTEGER NOT NULL,
FOREIGN KEY (skill_id) REFERENCES Skills(skill_id),
FOREIGN KEY (engineer_id) REFERENCES Maintenance_Engineers(engineer_id)
);
CREATE TABLE Fault_Log (
fault_log_entry_id INTEGER PRIMARY KEY,
asset_id INTEGER NOT NULL,
recorded_by_staff_id INTEGER NOT NULL,
fault_log_entry_datetime DATETIME,
fault_description VARCHAR(255),
other_fault_details VARCHAR(255),
FOREIGN KEY (recorded_by_staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (asset_id) REFERENCES Assets(asset_id)
);
CREATE TABLE Engineer_Visits (
engineer_visit_id INTEGER PRIMARY KEY,
contact_staff_id INTEGER,
engineer_id INTEGER NOT NULL,
fault_log_entry_id INTEGER NOT NULL,
fault_status VARCHAR(10) NOT NULL,
visit_start_datetime DATETIME,
visit_end_datetime DATETIME,
other_visit_details VARCHAR(255),
FOREIGN KEY (contact_staff_id) REFERENCES Staff(staff_id),
FOREIGN KEY (engineer_id) REFERENCES Maintenance_Engineers(engineer_id),
FOREIGN KEY (fault_log_entry_id) REFERENCES Fault_Log(fault_log_entry_id)
);
CREATE TABLE Part_Faults (
part_fault_id INTEGER PRIMARY KEY,
part_id INTEGER NOT NULL,
fault_short_name VARCHAR(20),
fault_description VARCHAR(255),
other_fault_details VARCHAR(255),
FOREIGN KEY (part_id) REFERENCES Parts(part_id)
);
CREATE TABLE Fault_Log_Parts (
fault_log_entry_id INTEGER NOT NULL,
part_fault_id INTEGER NOT NULL,
fault_status VARCHAR(10) NOT NULL,
FOREIGN KEY (fault_log_entry_id) REFERENCES Fault_Log(fault_log_entry_id),
FOREIGN KEY (part_fault_id) REFERENCES Part_Faults(part_fault_id)
);
CREATE TABLE Skills_Required_To_Fix (
part_fault_id INTEGER NOT NULL,
skill_id INTEGER NOT NULL,
FOREIGN KEY (skill_id) REFERENCES Skills(skill_id),
FOREIGN KEY (part_fault_id) REFERENCES Part_Faults(part_fault_id)
); |
election | {"county": {"columns": [[0, "County_Id", "INT", 0, null, 1], [1, "County_name", "TEXT", 0, null, 0], [2, "Population", "REAL", 0, null, 0], [3, "Zip_code", "TEXT", 0, null, 0]], "primary_keys": ["County_Id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "County_Id"]]], "check_constraints": []}, "party": {"columns": [[0, "Party_ID", "INT", 0, null, 1], [1, "Year", "REAL", 0, null, 0], [2, "Party", "TEXT", 0, null, 0], [3, "Governor", "TEXT", 0, null, 0], [4, "Lieutenant_Governor", "TEXT", 0, null, 0], [5, "Comptroller", "TEXT", 0, null, 0], [6, "Attorney_General", "TEXT", 0, null, 0], [7, "US_Senate", "TEXT", 0, null, 0]], "primary_keys": ["Party_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Party_ID"]]], "check_constraints": []}, "election": {"columns": [[0, "Election_ID", "INT", 0, null, 1], [1, "Counties_Represented", "TEXT", 0, null, 0], [2, "District", "INT", 0, null, 0], [3, "Delegate", "TEXT", 0, null, 0], [4, "Party", "INT", 0, null, 0], [5, "First_Elected", "REAL", 0, null, 0], [6, "Committee", "TEXT", 0, null, 0]], "primary_keys": ["Election_ID"], "foreign_keys": [[0, 0, "county", "District", "County_Id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "party", "Party", "Party_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Election_ID"]]], "check_constraints": []}} | CREATE TABLE county (
County_Id INT PRIMARY KEY,
County_name TEXT,
Population REAL,
Zip_code TEXT,
UNIQUE (County_Id)
);
CREATE TABLE party (
Party_ID INT PRIMARY KEY,
Year REAL,
Party TEXT,
Governor TEXT,
Lieutenant_Governor TEXT,
Comptroller TEXT,
Attorney_General TEXT,
US_Senate TEXT,
UNIQUE (Party_ID)
);
CREATE TABLE election (
Election_ID INT PRIMARY KEY,
Counties_Represented TEXT,
District INT,
Delegate TEXT,
Party INT,
First_Elected REAL,
Committee TEXT,
UNIQUE (Election_ID),
FOREIGN KEY (District) REFERENCES county(County_Id),
FOREIGN KEY (Party) REFERENCES party(Party_ID)
); |
tracking_orders | {"Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "customer_name", "VARCHAR(80)", 0, null, 0], [2, "customer_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Invoices": {"columns": [[0, "invoice_number", "INTEGER", 0, null, 1], [1, "invoice_date", "DATETIME", 0, null, 0], [2, "invoice_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["invoice_number"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Orders": {"columns": [[0, "order_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "order_status", "VARCHAR(10)", 1, null, 0], [3, "date_order_placed", "DATETIME", 1, 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": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "product_name", "VARCHAR(80)", 0, null, 0], [2, "product_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Order_Items": {"columns": [[0, "order_item_id", "INTEGER", 0, null, 1], [1, "product_id", "INTEGER", 1, null, 0], [2, "order_id", "INTEGER", 1, null, 0], [3, "order_item_status", "VARCHAR(10)", 1, null, 0], [4, "order_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, "Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Shipments": {"columns": [[0, "shipment_id", "INTEGER", 0, null, 1], [1, "order_id", "INTEGER", 1, null, 0], [2, "invoice_number", "INTEGER", 1, null, 0], [3, "shipment_tracking_number", "VARCHAR(80)", 0, null, 0], [4, "shipment_date", "DATETIME", 0, null, 0], [5, "other_shipment_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["shipment_id"], "foreign_keys": [[0, 0, "Invoices", "invoice_number", "invoice_number", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Orders", "order_id", "order_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Shipment_Items": {"columns": [[0, "shipment_id", "INTEGER", 1, null, 0], [1, "order_item_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Shipments", "shipment_id", "shipment_id", "NO ACTION", "NO ACTION", "NONE"], [1, 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_name VARCHAR(80),
customer_details VARCHAR(255)
);
CREATE TABLE Invoices (
invoice_number INTEGER PRIMARY KEY,
invoice_date DATETIME,
invoice_details VARCHAR(255)
);
CREATE TABLE Orders (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_status VARCHAR(10) NOT NULL,
date_order_placed DATETIME NOT NULL,
order_details VARCHAR(255),
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
product_name VARCHAR(80),
product_details VARCHAR(255)
);
CREATE TABLE Order_Items (
order_item_id INTEGER PRIMARY KEY,
product_id INTEGER NOT NULL,
order_id INTEGER NOT NULL,
order_item_status VARCHAR(10) NOT NULL,
order_item_details VARCHAR(255),
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (order_id) REFERENCES Orders(order_id)
);
CREATE TABLE Shipments (
shipment_id INTEGER PRIMARY KEY,
order_id INTEGER NOT NULL,
invoice_number INTEGER NOT NULL,
shipment_tracking_number VARCHAR(80),
shipment_date DATETIME,
other_shipment_details VARCHAR(255),
FOREIGN KEY (invoice_number) REFERENCES Invoices(invoice_number),
FOREIGN KEY (order_id) REFERENCES Orders(order_id)
);
CREATE TABLE Shipment_Items (
shipment_id INTEGER NOT NULL,
order_item_id INTEGER NOT NULL,
FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id),
FOREIGN KEY (order_item_id) REFERENCES Order_Items(order_item_id)
); |
student_1 | {"list": {"columns": [[0, "LastName", "TEXT", 0, null, 1], [1, "FirstName", "TEXT", 0, null, 2], [2, "Grade", "INTEGER", 0, null, 0], [3, "Classroom", "INTEGER", 0, null, 0]], "primary_keys": ["LastName", "FirstName"], "foreign_keys": [], "unique_constraints": [[[0, 0, "LastName"], [1, 1, "FirstName"]]], "check_constraints": []}, "teachers": {"columns": [[0, "LastName", "TEXT", 0, null, 1], [1, "FirstName", "TEXT", 0, null, 2], [2, "Classroom", "INTEGER", 0, null, 0]], "primary_keys": ["LastName", "FirstName"], "foreign_keys": [], "unique_constraints": [[[0, 0, "LastName"], [1, 1, "FirstName"]]], "check_constraints": []}} | CREATE TABLE list (
LastName TEXT PRIMARY KEY,
FirstName TEXT PRIMARY KEY,
Grade INTEGER,
Classroom INTEGER,
PRIMARY KEY (LastName, FirstName),
UNIQUE (LastName, FirstName)
);
CREATE TABLE teachers (
LastName TEXT PRIMARY KEY,
FirstName TEXT PRIMARY KEY,
Classroom INTEGER,
PRIMARY KEY (LastName, FirstName),
UNIQUE (LastName, FirstName)
); |
entertainment_awards | {"festival_detail": {"columns": [[0, "Festival_ID", "INT", 0, null, 1], [1, "Festival_Name", "TEXT", 0, null, 0], [2, "Chair_Name", "TEXT", 0, null, 0], [3, "Location", "TEXT", 0, null, 0], [4, "Year", "INT", 0, null, 0], [5, "Num_of_Audience", "INT", 0, null, 0]], "primary_keys": ["Festival_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Festival_ID"]]], "check_constraints": []}, "artwork": {"columns": [[0, "Artwork_ID", "INT", 0, null, 1], [1, "Type", "TEXT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0]], "primary_keys": ["Artwork_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Artwork_ID"]]], "check_constraints": []}, "nomination": {"columns": [[0, "Artwork_ID", "INT", 0, null, 1], [1, "Festival_ID", "INT", 0, null, 2], [2, "Result", "TEXT", 0, null, 0]], "primary_keys": ["Artwork_ID", "Festival_ID"], "foreign_keys": [[0, 0, "festival_detail", "Festival_ID", "Festival_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "artwork", "Artwork_ID", "Artwork_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Artwork_ID"], [1, 1, "Festival_ID"]]], "check_constraints": []}} | CREATE TABLE festival_detail (
Festival_ID INT PRIMARY KEY,
Festival_Name TEXT,
Chair_Name TEXT,
Location TEXT,
Year INT,
Num_of_Audience INT,
UNIQUE (Festival_ID)
);
CREATE TABLE artwork (
Artwork_ID INT PRIMARY KEY,
Type TEXT,
Name TEXT,
UNIQUE (Artwork_ID)
);
CREATE TABLE nomination (
Artwork_ID INT PRIMARY KEY,
Festival_ID INT PRIMARY KEY,
Result TEXT,
PRIMARY KEY (Artwork_ID, Festival_ID),
UNIQUE (Artwork_ID, Festival_ID),
FOREIGN KEY (Festival_ID) REFERENCES festival_detail(Festival_ID),
FOREIGN KEY (Artwork_ID) REFERENCES artwork(Artwork_ID)
); |
customer_complaints | {"Staff": {"columns": [[0, "staff_id", "INTEGER", 0, null, 1], [1, "gender", "VARCHAR(1)", 0, null, 0], [2, "first_name", "VARCHAR(80)", 0, null, 0], [3, "last_name", "VARCHAR(80)", 0, null, 0], [4, "email_address", "VARCHAR(255)", 0, null, 0], [5, "phone_number", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["staff_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "customer_type_code", "VARCHAR(20)", 1, null, 0], [2, "address_line_1", "VARCHAR(80)", 0, null, 0], [3, "address_line_2", "VARCHAR(80)", 0, null, 0], [4, "town_city", "VARCHAR(80)", 0, null, 0], [5, "state", "VARCHAR(80)", 0, null, 0], [6, "email_address", "VARCHAR(255)", 0, null, 0], [7, "phone_number", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Products": {"columns": [[0, "product_id", "INTEGER", 0, null, 1], [1, "parent_product_id", "INTEGER", 0, null, 0], [2, "product_category_code", "VARCHAR(20)", 1, null, 0], [3, "date_product_first_available", "DATETIME", 0, null, 0], [4, "date_product_discontinued", "DATETIME", 0, null, 0], [5, "product_name", "VARCHAR(80)", 0, null, 0], [6, "product_description", "VARCHAR(255)", 0, null, 0], [7, "product_price", "DECIMAL(19,4)", 0, null, 0]], "primary_keys": ["product_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Complaints": {"columns": [[0, "complaint_id", "INTEGER", 1, null, 0], [1, "product_id", "INTEGER", 1, null, 0], [2, "customer_id", "INTEGER", 1, null, 0], [3, "complaint_outcome_code", "VARCHAR(20)", 1, null, 0], [4, "complaint_status_code", "VARCHAR(20)", 1, null, 0], [5, "complaint_type_code", "VARCHAR(20)", 1, null, 0], [6, "date_complaint_raised", "DATETIME", 0, null, 0], [7, "date_complaint_closed", "DATETIME", 0, null, 0], [8, "staff_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Customers", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Products", "product_id", "product_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Staff", "staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Staff (
staff_id INTEGER PRIMARY KEY,
gender VARCHAR(1),
first_name VARCHAR(80),
last_name VARCHAR(80),
email_address VARCHAR(255),
phone_number VARCHAR(80)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
customer_type_code VARCHAR(20) NOT NULL,
address_line_1 VARCHAR(80),
address_line_2 VARCHAR(80),
town_city VARCHAR(80),
state VARCHAR(80),
email_address VARCHAR(255),
phone_number VARCHAR(80)
);
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY,
parent_product_id INTEGER,
product_category_code VARCHAR(20) NOT NULL,
date_product_first_available DATETIME,
date_product_discontinued DATETIME,
product_name VARCHAR(80),
product_description VARCHAR(255),
product_price DECIMAL(19,4)
);
CREATE TABLE Complaints (
complaint_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
complaint_outcome_code VARCHAR(20) NOT NULL,
complaint_status_code VARCHAR(20) NOT NULL,
complaint_type_code VARCHAR(20) NOT NULL,
date_complaint_raised DATETIME,
date_complaint_closed DATETIME,
staff_id INTEGER NOT NULL,
FOREIGN KEY (customer_id) REFERENCES Customers(customer_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id),
FOREIGN KEY (staff_id) REFERENCES Staff(staff_id)
); |
music_1 | {"genre": {"columns": [[0, "g_name", "varchar2(20)", 1, null, 1], [1, "rating", "varchar2(10)", 0, null, 0], [2, "most_popular_in", "varchar2(50)", 0, null, 0]], "primary_keys": ["g_name"], "foreign_keys": [], "unique_constraints": [[[0, 0, "g_name"]]], "check_constraints": []}, "artist": {"columns": [[0, "artist_name", "varchar2(50)", 1, null, 1], [1, "country", "varchar2(20)", 0, null, 0], [2, "gender", "varchar2(20)", 0, null, 0], [3, "preferred_genre", "varchar2(50)", 0, null, 0]], "primary_keys": ["artist_name"], "foreign_keys": [[0, 0, "genre", "preferred_genre", "g_name", "NO ACTION", "CASCADE", "NONE"]], "unique_constraints": [[[0, 0, "artist_name"]]], "check_constraints": []}, "files": {"columns": [[0, "f_id", "number(10)", 1, null, 1], [1, "artist_name", "varchar2(50)", 0, null, 0], [2, "file_size", "varchar2(20)", 0, null, 0], [3, "duration", "varchar2(20)", 0, null, 0], [4, "formats", "varchar2(20)", 0, null, 0]], "primary_keys": ["f_id"], "foreign_keys": [[0, 0, "artist", "artist_name", "artist_name", "NO ACTION", "CASCADE", "NONE"]], "unique_constraints": [[[0, 0, "f_id"]]], "check_constraints": []}, "song": {"columns": [[0, "song_name", "varchar2(50)", 0, null, 1], [1, "artist_name", "varchar2(50)", 0, null, 0], [2, "country", "varchar2(20)", 0, null, 0], [3, "f_id", "number(10)", 0, null, 0], [4, "genre_is", "varchar2(20)", 0, null, 0], [5, "rating", "number(10)", 0, null, 0], [6, "languages", "varchar2(20)", 0, null, 0], [7, "releasedate", "Date", 0, null, 0], [8, "resolution", "number(10)", 1, null, 0]], "primary_keys": ["song_name"], "foreign_keys": [[0, 0, "genre", "genre_is", "g_name", "NO ACTION", "CASCADE", "NONE"], [1, 0, "files", "f_id", "f_id", "NO ACTION", "CASCADE", "NONE"], [2, 0, "artist", "artist_name", "artist_name", "NO ACTION", "CASCADE", "NONE"]], "unique_constraints": [[[0, 0, "song_name"]]], "check_constraints": ["rating number(10) check(rating>0 and rating<11),"]}} | CREATE TABLE genre (
g_name varchar2(20) NOT NULL PRIMARY KEY,
rating varchar2(10),
most_popular_in varchar2(50),
UNIQUE (g_name)
);
CREATE TABLE artist (
artist_name varchar2(50) NOT NULL PRIMARY KEY,
country varchar2(20),
gender varchar2(20),
preferred_genre varchar2(50),
UNIQUE (artist_name),
FOREIGN KEY (preferred_genre) REFERENCES genre(g_name)
);
CREATE TABLE files (
f_id number(10) NOT NULL PRIMARY KEY,
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20),
UNIQUE (f_id),
FOREIGN KEY (artist_name) REFERENCES artist(artist_name)
);
CREATE TABLE song (
song_name varchar2(50) PRIMARY KEY,
artist_name varchar2(50),
country varchar2(20),
f_id number(10),
genre_is varchar2(20),
rating number(10),
languages varchar2(20),
releasedate Date,
resolution number(10) NOT NULL,
UNIQUE (song_name),
FOREIGN KEY (genre_is) REFERENCES genre(g_name),
FOREIGN KEY (f_id) REFERENCES files(f_id),
FOREIGN KEY (artist_name) REFERENCES artist(artist_name),
rating number(10) check(rating>0 and rating<11),
); |
film_rank | {"film": {"columns": [[0, "Film_ID", "INT", 0, null, 1], [1, "Title", "TEXT", 0, null, 0], [2, "Studio", "TEXT", 0, null, 0], [3, "Director", "TEXT", 0, null, 0], [4, "Gross_in_dollar", "INT", 0, null, 0]], "primary_keys": ["Film_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Film_ID"]]], "check_constraints": []}, "market": {"columns": [[0, "Market_ID", "INT", 0, null, 1], [1, "Country", "TEXT", 0, null, 0], [2, "Number_cities", "INT", 0, null, 0]], "primary_keys": ["Market_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Market_ID"]]], "check_constraints": []}, "film_market_estimation": {"columns": [[0, "Estimation_ID", "INT", 0, null, 1], [1, "Low_Estimate", "REAL", 0, null, 0], [2, "High_Estimate", "REAL", 0, null, 0], [3, "Film_ID", "INT", 0, null, 0], [4, "Type", "TEXT", 0, null, 0], [5, "Market_ID", "INT", 0, null, 0], [6, "Year", "INT", 0, null, 0]], "primary_keys": ["Estimation_ID"], "foreign_keys": [[0, 0, "market", "Market_ID", "Market_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "film", "Film_ID", "Film_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Estimation_ID"]]], "check_constraints": []}} | CREATE TABLE film (
Film_ID INT PRIMARY KEY,
Title TEXT,
Studio TEXT,
Director TEXT,
Gross_in_dollar INT,
UNIQUE (Film_ID)
);
CREATE TABLE market (
Market_ID INT PRIMARY KEY,
Country TEXT,
Number_cities INT,
UNIQUE (Market_ID)
);
CREATE TABLE film_market_estimation (
Estimation_ID INT PRIMARY KEY,
Low_Estimate REAL,
High_Estimate REAL,
Film_ID INT,
Type TEXT,
Market_ID INT,
Year INT,
UNIQUE (Estimation_ID),
FOREIGN KEY (Market_ID) REFERENCES market(Market_ID),
FOREIGN KEY (Film_ID) REFERENCES film(Film_ID)
); |
station_weather | {"train": {"columns": [[0, "id", "INT", 0, null, 1], [1, "train_number", "INT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "origin", "TEXT", 0, null, 0], [4, "destination", "TEXT", 0, null, 0], [5, "time", "TEXT", 0, null, 0], [6, "interval", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "station": {"columns": [[0, "id", "INT", 0, null, 1], [1, "network_name", "TEXT", 0, null, 0], [2, "services", "TEXT", 0, null, 0], [3, "local_authority", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "route": {"columns": [[0, "train_id", "INT", 0, null, 1], [1, "station_id", "INT", 0, null, 2]], "primary_keys": ["train_id", "station_id"], "foreign_keys": [[0, 0, "station", "station_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "train", "train_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "train_id"], [1, 1, "station_id"]]], "check_constraints": []}, "weekly_weather": {"columns": [[0, "station_id", "INT", 0, null, 1], [1, "day_of_week", "TEXT", 0, null, 2], [2, "high_temperature", "INT", 0, null, 0], [3, "low_temperature", "INT", 0, null, 0], [4, "precipitation", "REAL", 0, null, 0], [5, "wind_speed_mph", "INT", 0, null, 0]], "primary_keys": ["station_id", "day_of_week"], "foreign_keys": [[0, 0, "station", "station_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "station_id"], [1, 1, "day_of_week"]]], "check_constraints": []}} | CREATE TABLE train (
id INT PRIMARY KEY,
train_number INT,
name TEXT,
origin TEXT,
destination TEXT,
time TEXT,
interval TEXT,
UNIQUE (id)
);
CREATE TABLE station (
id INT PRIMARY KEY,
network_name TEXT,
services TEXT,
local_authority TEXT,
UNIQUE (id)
);
CREATE TABLE route (
train_id INT PRIMARY KEY,
station_id INT PRIMARY KEY,
PRIMARY KEY (train_id, station_id),
UNIQUE (train_id, station_id),
FOREIGN KEY (station_id) REFERENCES station(id),
FOREIGN KEY (train_id) REFERENCES train(id)
);
CREATE TABLE weekly_weather (
station_id INT PRIMARY KEY,
day_of_week TEXT PRIMARY KEY,
high_temperature INT,
low_temperature INT,
precipitation REAL,
wind_speed_mph INT,
PRIMARY KEY (station_id, day_of_week),
UNIQUE (station_id, day_of_week),
FOREIGN KEY (station_id) REFERENCES station(id)
); |
voter_1 | {"AREA_CODE_STATE": {"columns": [[0, "area_code", "INTEGER", 1, null, 1], [1, "state", "varchar(2)", 1, null, 0]], "primary_keys": ["area_code"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "CONTESTANTS": {"columns": [[0, "contestant_number", "INTEGER", 0, null, 1], [1, "contestant_name", "varchar(50)", 1, null, 0]], "primary_keys": ["contestant_number"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "VOTES": {"columns": [[0, "vote_id", "INTEGER", 1, null, 1], [1, "phone_number", "INTEGER", 1, null, 0], [2, "state", "varchar(2)", 1, null, 0], [3, "contestant_number", "INTEGER", 1, null, 0], [4, "created", "timestamp", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["vote_id"], "foreign_keys": [[0, 0, "CONTESTANTS", "contestant_number", "contestant_number", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "AREA_CODE_STATE", "state", "state", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE AREA_CODE_STATE (
area_code INTEGER NOT NULL PRIMARY KEY,
state varchar(2) NOT NULL
);
CREATE TABLE CONTESTANTS (
contestant_number INTEGER PRIMARY KEY,
contestant_name varchar(50) NOT NULL
);
CREATE TABLE VOTES (
vote_id INTEGER NOT NULL PRIMARY KEY,
phone_number INTEGER NOT NULL,
state varchar(2) NOT NULL,
contestant_number INTEGER NOT NULL,
created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (contestant_number) REFERENCES CONTESTANTS(contestant_number),
FOREIGN KEY (state) REFERENCES AREA_CODE_STATE(state)
); |
school_finance | {"School": {"columns": [[0, "School_id", "TEXT", 0, null, 1], [1, "School_name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Mascot", "TEXT", 0, null, 0], [4, "Enrollment", "INT", 0, null, 0], [5, "IHSAA_Class", "TEXT", 0, null, 0], [6, "IHSAA_Football_Class", "TEXT", 0, null, 0], [7, "County", "TEXT", 0, null, 0]], "primary_keys": ["School_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "School_id"]]], "check_constraints": []}, "budget": {"columns": [[0, "School_id", "INT", 0, null, 1], [1, "Year", "INT", 0, null, 2], [2, "Budgeted", "INT", 0, null, 0], [3, "total_budget_percent_budgeted", "REAL", 0, null, 0], [4, "Invested", "INT", 0, null, 0], [5, "total_budget_percent_invested", "REAL", 0, null, 0], [6, "Budget_invested_percent", "TEXT", 0, null, 0]], "primary_keys": ["School_id", "Year"], "foreign_keys": [[0, 0, "School", "School_id", "School_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "School_id"], [1, 1, "Year"]]], "check_constraints": []}, "endowment": {"columns": [[0, "endowment_id", "INT", 0, null, 1], [1, "School_id", "INT", 0, null, 0], [2, "donator_name", "TEXT", 0, null, 0], [3, "amount", "REAL", 0, null, 0]], "primary_keys": ["endowment_id"], "foreign_keys": [[0, 0, "School", "School_id", "School_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "endowment_id"]]], "check_constraints": []}} | CREATE TABLE School (
School_id TEXT PRIMARY KEY,
School_name TEXT,
Location TEXT,
Mascot TEXT,
Enrollment INT,
IHSAA_Class TEXT,
IHSAA_Football_Class TEXT,
County TEXT,
UNIQUE (School_id)
);
CREATE TABLE budget (
School_id INT PRIMARY KEY,
Year INT PRIMARY KEY,
Budgeted INT,
total_budget_percent_budgeted REAL,
Invested INT,
total_budget_percent_invested REAL,
Budget_invested_percent TEXT,
PRIMARY KEY (School_id, Year),
UNIQUE (School_id, Year),
FOREIGN KEY (School_id) REFERENCES School(School_id)
);
CREATE TABLE endowment (
endowment_id INT PRIMARY KEY,
School_id INT,
donator_name TEXT,
amount REAL,
UNIQUE (endowment_id),
FOREIGN KEY (School_id) REFERENCES School(School_id)
); |
voter_2 | {"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": []}, "Voting_record": {"columns": [[0, "StuID", "INTEGER", 0, null, 0], [1, "Registration_Date", "VARCHAR(12)", 0, null, 0], [2, "Election_Cycle", "VARCHAR(12)", 0, null, 0], [3, "President_Vote", "INTEGER", 0, null, 0], [4, "Vice_President_Vote", "INTEGER", 0, null, 0], [5, "Secretary_Vote", "INTEGER", 0, null, 0], [6, "Treasurer_Vote", "INTEGER", 0, null, 0], [7, "Class_President_Vote", "INTEGER", 0, null, 0], [8, "Class_Senator_Vote", "INTEGER", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Student", "Class_Senator_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Student", "Class_President_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Student", "Treasurer_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [3, 0, "Student", "Secretary_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [4, 0, "Student", "Vice_President_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [5, 0, "Student", "President_Vote", "StuID", "NO ACTION", "NO ACTION", "NONE"], [6, 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 Voting_record (
StuID INTEGER,
Registration_Date VARCHAR(12),
Election_Cycle VARCHAR(12),
President_Vote INTEGER,
Vice_President_Vote INTEGER,
Secretary_Vote INTEGER,
Treasurer_Vote INTEGER,
Class_President_Vote INTEGER,
Class_Senator_Vote INTEGER,
FOREIGN KEY (Class_Senator_Vote) REFERENCES Student(StuID),
FOREIGN KEY (Class_President_Vote) REFERENCES Student(StuID),
FOREIGN KEY (Treasurer_Vote) REFERENCES Student(StuID),
FOREIGN KEY (Secretary_Vote) REFERENCES Student(StuID),
FOREIGN KEY (Vice_President_Vote) REFERENCES Student(StuID),
FOREIGN KEY (President_Vote) REFERENCES Student(StuID),
FOREIGN KEY (StuID) REFERENCES Student(StuID)
); |
musical | {"musical": {"columns": [[0, "Musical_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Year", "INT", 0, null, 0], [3, "Award", "TEXT", 0, null, 0], [4, "Category", "TEXT", 0, null, 0], [5, "Nominee", "TEXT", 0, null, 0], [6, "Result", "TEXT", 0, null, 0]], "primary_keys": ["Musical_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Musical_ID"]]], "check_constraints": []}, "actor": {"columns": [[0, "Actor_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Musical_ID", "INT", 0, null, 0], [3, "Character", "TEXT", 0, null, 0], [4, "Duration", "TEXT", 0, null, 0], [5, "age", "INT", 0, null, 0]], "primary_keys": ["Actor_ID"], "foreign_keys": [[0, 0, "actor", "Musical_ID", "Actor_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Actor_ID"]]], "check_constraints": []}} | CREATE TABLE musical (
Musical_ID INT PRIMARY KEY,
Name TEXT,
Year INT,
Award TEXT,
Category TEXT,
Nominee TEXT,
Result TEXT,
UNIQUE (Musical_ID)
);
CREATE TABLE actor (
Actor_ID INT PRIMARY KEY,
Name TEXT,
Musical_ID INT,
Character TEXT,
Duration TEXT,
age INT,
UNIQUE (Actor_ID),
FOREIGN KEY (Musical_ID) REFERENCES actor(Actor_ID)
); |
mountain_photos | {"mountain": {"columns": [[0, "id", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Height", "REAL", 0, null, 0], [3, "Prominence", "REAL", 0, null, 0], [4, "Range", "TEXT", 0, null, 0], [5, "Country", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "camera_lens": {"columns": [[0, "id", "INT", 0, null, 1], [1, "brand", "TEXT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "focal_length_mm", "REAL", 0, null, 0], [4, "max_aperture", "REAL", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "photos": {"columns": [[0, "id", "INT", 0, null, 1], [1, "camera_lens_id", "INT", 0, null, 0], [2, "mountain_id", "INT", 0, null, 0], [3, "color", "TEXT", 0, null, 0], [4, "name", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "mountain", "mountain_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "camera_lens", "camera_lens_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}} | CREATE TABLE mountain (
id INT PRIMARY KEY,
name TEXT,
Height REAL,
Prominence REAL,
Range TEXT,
Country TEXT,
UNIQUE (id)
);
CREATE TABLE camera_lens (
id INT PRIMARY KEY,
brand TEXT,
name TEXT,
focal_length_mm REAL,
max_aperture REAL,
UNIQUE (id)
);
CREATE TABLE photos (
id INT PRIMARY KEY,
camera_lens_id INT,
mountain_id INT,
color TEXT,
name TEXT,
UNIQUE (id),
FOREIGN KEY (mountain_id) REFERENCES mountain(id),
FOREIGN KEY (camera_lens_id) REFERENCES camera_lens(id)
); |
wrestler | {"wrestler": {"columns": [[0, "Wrestler_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Reign", "TEXT", 0, null, 0], [3, "Days_held", "TEXT", 0, null, 0], [4, "Location", "TEXT", 0, null, 0], [5, "Event", "TEXT", 0, null, 0]], "primary_keys": ["Wrestler_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Wrestler_ID"]]], "check_constraints": []}, "Elimination": {"columns": [[0, "Elimination_ID", "TEXT", 0, null, 1], [1, "Wrestler_ID", "TEXT", 0, null, 0], [2, "Team", "TEXT", 0, null, 0], [3, "Eliminated_By", "TEXT", 0, null, 0], [4, "Elimination_Move", "TEXT", 0, null, 0], [5, "Time", "TEXT", 0, null, 0]], "primary_keys": ["Elimination_ID"], "foreign_keys": [[0, 0, "wrestler", "Wrestler_ID", "Wrestler_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Elimination_ID"]]], "check_constraints": []}} | CREATE TABLE wrestler (
Wrestler_ID INT PRIMARY KEY,
Name TEXT,
Reign TEXT,
Days_held TEXT,
Location TEXT,
Event TEXT,
UNIQUE (Wrestler_ID)
);
CREATE TABLE Elimination (
Elimination_ID TEXT PRIMARY KEY,
Wrestler_ID TEXT,
Team TEXT,
Eliminated_By TEXT,
Elimination_Move TEXT,
Time TEXT,
UNIQUE (Elimination_ID),
FOREIGN KEY (Wrestler_ID) REFERENCES wrestler(Wrestler_ID)
); |
school_bus | {"driver": {"columns": [[0, "Driver_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Party", "TEXT", 0, null, 0], [3, "Home_city", "TEXT", 0, null, 0], [4, "Age", "INT", 0, null, 0]], "primary_keys": ["Driver_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Driver_ID"]]], "check_constraints": []}, "school": {"columns": [[0, "School_ID", "INT", 0, null, 1], [1, "Grade", "TEXT", 0, null, 0], [2, "School", "TEXT", 0, null, 0], [3, "Location", "TEXT", 0, null, 0], [4, "Type", "TEXT", 0, null, 0]], "primary_keys": ["School_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "School_ID"]]], "check_constraints": []}, "school_bus": {"columns": [[0, "School_ID", "INT", 0, null, 1], [1, "Driver_ID", "INT", 0, null, 2], [2, "Years_Working", "INT", 0, null, 0], [3, "If_full_time", "bool", 0, null, 0]], "primary_keys": ["School_ID", "Driver_ID"], "foreign_keys": [[0, 0, "driver", "Driver_ID", "Driver_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "school", "School_ID", "School_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "School_ID"], [1, 1, "Driver_ID"]]], "check_constraints": []}} | CREATE TABLE driver (
Driver_ID INT PRIMARY KEY,
Name TEXT,
Party TEXT,
Home_city TEXT,
Age INT,
UNIQUE (Driver_ID)
);
CREATE TABLE school (
School_ID INT PRIMARY KEY,
Grade TEXT,
School TEXT,
Location TEXT,
Type TEXT,
UNIQUE (School_ID)
);
CREATE TABLE school_bus (
School_ID INT PRIMARY KEY,
Driver_ID INT PRIMARY KEY,
Years_Working INT,
If_full_time bool,
PRIMARY KEY (School_ID, Driver_ID),
UNIQUE (School_ID, Driver_ID),
FOREIGN KEY (Driver_ID) REFERENCES driver(Driver_ID),
FOREIGN KEY (School_ID) REFERENCES school(School_ID)
); |
gymnast | {"gymnast": {"columns": [[0, "Gymnast_ID", "INT", 0, null, 1], [1, "Floor_Exercise_Points", "REAL", 0, null, 0], [2, "Pommel_Horse_Points", "REAL", 0, null, 0], [3, "Rings_Points", "REAL", 0, null, 0], [4, "Vault_Points", "REAL", 0, null, 0], [5, "Parallel_Bars_Points", "REAL", 0, null, 0], [6, "Horizontal_Bar_Points", "REAL", 0, null, 0], [7, "Total_Points", "REAL", 0, null, 0]], "primary_keys": ["Gymnast_ID"], "foreign_keys": [[0, 0, "people", "Gymnast_ID", "People_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Gymnast_ID"]]], "check_constraints": []}, "people": {"columns": [[0, "People_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Age", "REAL", 0, null, 0], [3, "Height", "REAL", 0, null, 0], [4, "Hometown", "TEXT", 0, null, 0]], "primary_keys": ["People_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "People_ID"]]], "check_constraints": []}} | CREATE TABLE gymnast (
Gymnast_ID INT PRIMARY KEY,
Floor_Exercise_Points REAL,
Pommel_Horse_Points REAL,
Rings_Points REAL,
Vault_Points REAL,
Parallel_Bars_Points REAL,
Horizontal_Bar_Points REAL,
Total_Points REAL,
UNIQUE (Gymnast_ID),
FOREIGN KEY (Gymnast_ID) REFERENCES people(People_ID)
);
CREATE TABLE people (
People_ID INT PRIMARY KEY,
Name TEXT,
Age REAL,
Height REAL,
Hometown TEXT,
UNIQUE (People_ID)
); |
theme_gallery | {"artist": {"columns": [[0, "Artist_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Country", "TEXT", 0, null, 0], [3, "Year_Join", "INT", 0, null, 0], [4, "Age", "INT", 0, null, 0]], "primary_keys": ["Artist_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Artist_ID"]]], "check_constraints": []}, "exhibition": {"columns": [[0, "Exhibition_ID", "INT", 0, null, 1], [1, "Year", "INT", 0, null, 0], [2, "Theme", "TEXT", 0, null, 0], [3, "Artist_ID", "INT", 0, null, 0], [4, "Ticket_Price", "REAL", 0, null, 0]], "primary_keys": ["Exhibition_ID"], "foreign_keys": [[0, 0, "artist", "Artist_ID", "Artist_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Exhibition_ID"]]], "check_constraints": []}, "exhibition_record": {"columns": [[0, "Exhibition_ID", "INT", 0, null, 1], [1, "Date", "TEXT", 0, null, 2], [2, "Attendance", "INT", 0, null, 0]], "primary_keys": ["Exhibition_ID", "Date"], "foreign_keys": [[0, 0, "exhibition", "Exhibition_ID", "Exhibition_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Exhibition_ID"], [1, 1, "Date"]]], "check_constraints": []}} | CREATE TABLE artist (
Artist_ID INT PRIMARY KEY,
Name TEXT,
Country TEXT,
Year_Join INT,
Age INT,
UNIQUE (Artist_ID)
);
CREATE TABLE exhibition (
Exhibition_ID INT PRIMARY KEY,
Year INT,
Theme TEXT,
Artist_ID INT,
Ticket_Price REAL,
UNIQUE (Exhibition_ID),
FOREIGN KEY (Artist_ID) REFERENCES artist(Artist_ID)
);
CREATE TABLE exhibition_record (
Exhibition_ID INT PRIMARY KEY,
Date TEXT PRIMARY KEY,
Attendance INT,
PRIMARY KEY (Exhibition_ID, Date),
UNIQUE (Exhibition_ID, Date),
FOREIGN KEY (Exhibition_ID) REFERENCES exhibition(Exhibition_ID)
); |
museum_visit | {"museum": {"columns": [[0, "Museum_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Num_of_Staff", "INT", 0, null, 0], [3, "Open_Year", "TEXT", 0, null, 0]], "primary_keys": ["Museum_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Museum_ID"]]], "check_constraints": []}, "visitor": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Level_of_membership", "INT", 0, null, 0], [3, "Age", "INT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}, "visit": {"columns": [[0, "Museum_ID", "INT", 0, null, 1], [1, "visitor_ID", "TEXT", 0, null, 2], [2, "Num_of_Ticket", "INT", 0, null, 0], [3, "Total_spent", "REAL", 0, null, 0]], "primary_keys": ["Museum_ID", "visitor_ID"], "foreign_keys": [[0, 0, "visitor", "visitor_ID", "ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "museum", "Museum_ID", "Museum_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Museum_ID"], [1, 1, "visitor_ID"]]], "check_constraints": []}} | CREATE TABLE museum (
Museum_ID INT PRIMARY KEY,
Name TEXT,
Num_of_Staff INT,
Open_Year TEXT,
UNIQUE (Museum_ID)
);
CREATE TABLE visitor (
ID INT PRIMARY KEY,
Name TEXT,
Level_of_membership INT,
Age INT,
UNIQUE (ID)
);
CREATE TABLE visit (
Museum_ID INT PRIMARY KEY,
visitor_ID TEXT PRIMARY KEY,
Num_of_Ticket INT,
Total_spent REAL,
PRIMARY KEY (Museum_ID, visitor_ID),
UNIQUE (Museum_ID, visitor_ID),
FOREIGN KEY (visitor_ID) REFERENCES visitor(ID),
FOREIGN KEY (Museum_ID) REFERENCES museum(Museum_ID)
); |
machine_repair | {"repair": {"columns": [[0, "repair_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Launch_Date", "TEXT", 0, null, 0], [3, "Notes", "TEXT", 0, null, 0]], "primary_keys": ["repair_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "repair_ID"]]], "check_constraints": []}, "machine": {"columns": [[0, "Machine_ID", "INT", 0, null, 1], [1, "Making_Year", "INT", 0, null, 0], [2, "Class", "TEXT", 0, null, 0], [3, "Team", "TEXT", 0, null, 0], [4, "Machine_series", "TEXT", 0, null, 0], [5, "value_points", "REAL", 0, null, 0], [6, "quality_rank", "INT", 0, null, 0]], "primary_keys": ["Machine_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Machine_ID"]]], "check_constraints": []}, "technician": {"columns": [[0, "technician_id", "REAL", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Team", "TEXT", 0, null, 0], [3, "Starting_Year", "REAL", 0, null, 0], [4, "Age", "INT", 0, null, 0]], "primary_keys": ["technician_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "technician_id"]]], "check_constraints": []}, "repair_assignment": {"columns": [[0, "technician_id", "INT", 0, null, 1], [1, "repair_ID", "INT", 0, null, 2], [2, "Machine_ID", "INT", 0, null, 3]], "primary_keys": ["technician_id", "repair_ID", "Machine_ID"], "foreign_keys": [[0, 0, "machine", "Machine_ID", "Machine_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "repair", "repair_ID", "repair_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "technician", "technician_id", "technician_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "technician_id"], [1, 1, "repair_ID"], [2, 2, "Machine_ID"]]], "check_constraints": []}} | CREATE TABLE repair (
repair_ID INT PRIMARY KEY,
name TEXT,
Launch_Date TEXT,
Notes TEXT,
UNIQUE (repair_ID)
);
CREATE TABLE machine (
Machine_ID INT PRIMARY KEY,
Making_Year INT,
Class TEXT,
Team TEXT,
Machine_series TEXT,
value_points REAL,
quality_rank INT,
UNIQUE (Machine_ID)
);
CREATE TABLE technician (
technician_id REAL PRIMARY KEY,
Name TEXT,
Team TEXT,
Starting_Year REAL,
Age INT,
UNIQUE (technician_id)
);
CREATE TABLE repair_assignment (
technician_id INT PRIMARY KEY,
repair_ID INT PRIMARY KEY,
Machine_ID INT PRIMARY KEY,
PRIMARY KEY (technician_id, repair_ID, Machine_ID),
UNIQUE (technician_id, repair_ID, Machine_ID),
FOREIGN KEY (Machine_ID) REFERENCES machine(Machine_ID),
FOREIGN KEY (repair_ID) REFERENCES repair(repair_ID),
FOREIGN KEY (technician_id) REFERENCES technician(technician_id)
); |
tvshow | {"TV_Channel": {"columns": [[0, "id", "TEXT", 0, null, 1], [1, "series_name", "TEXT", 0, null, 0], [2, "Country", "TEXT", 0, null, 0], [3, "Language", "TEXT", 0, null, 0], [4, "Content", "TEXT", 0, null, 0], [5, "Pixel_aspect_ratio_PAR", "TEXT", 0, null, 0], [6, "Hight_definition_TV", "TEXT", 0, null, 0], [7, "Pay_per_view_PPV", "TEXT", 0, null, 0], [8, "Package_Option", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "TV_series": {"columns": [[0, "id", "REAL", 0, null, 1], [1, "Episode", "TEXT", 0, null, 0], [2, "Air_Date", "TEXT", 0, null, 0], [3, "Rating", "TEXT", 0, null, 0], [4, "Share", "REAL", 0, null, 0], [5, "18_49_Rating_Share", "TEXT", 0, null, 0], [6, "Viewers_m", "TEXT", 0, null, 0], [7, "Weekly_Rank", "REAL", 0, null, 0], [8, "Channel", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "TV_Channel", "Channel", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "Cartoon": {"columns": [[0, "id", "REAL", 0, null, 1], [1, "Title", "TEXT", 0, null, 0], [2, "Directed_by", "TEXT", 0, null, 0], [3, "Written_by", "TEXT", 0, null, 0], [4, "Original_air_date", "TEXT", 0, null, 0], [5, "Production_code", "REAL", 0, null, 0], [6, "Channel", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [[0, 0, "TV_Channel", "Channel", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}} | CREATE TABLE TV_Channel (
id TEXT PRIMARY KEY,
series_name TEXT,
Country TEXT,
Language TEXT,
Content TEXT,
Pixel_aspect_ratio_PAR TEXT,
Hight_definition_TV TEXT,
Pay_per_view_PPV TEXT,
Package_Option TEXT,
UNIQUE (id)
);
CREATE TABLE TV_series (
id REAL PRIMARY KEY,
Episode TEXT,
Air_Date TEXT,
Rating TEXT,
Share REAL,
18_49_Rating_Share TEXT,
Viewers_m TEXT,
Weekly_Rank REAL,
Channel TEXT,
UNIQUE (id),
FOREIGN KEY (Channel) REFERENCES TV_Channel(id)
);
CREATE TABLE Cartoon (
id REAL PRIMARY KEY,
Title TEXT,
Directed_by TEXT,
Written_by TEXT,
Original_air_date TEXT,
Production_code REAL,
Channel TEXT,
UNIQUE (id),
FOREIGN KEY (Channel) REFERENCES TV_Channel(id)
); |
poker_player | {"poker_player": {"columns": [[0, "Poker_Player_ID", "INT", 0, null, 1], [1, "People_ID", "INT", 0, null, 0], [2, "Final_Table_Made", "REAL", 0, null, 0], [3, "Best_Finish", "REAL", 0, null, 0], [4, "Money_Rank", "REAL", 0, null, 0], [5, "Earnings", "REAL", 0, null, 0]], "primary_keys": ["Poker_Player_ID"], "foreign_keys": [[0, 0, "people", "People_ID", "People_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Poker_Player_ID"]]], "check_constraints": []}, "people": {"columns": [[0, "People_ID", "INT", 0, null, 1], [1, "Nationality", "TEXT", 0, null, 0], [2, "Name", "TEXT", 0, null, 0], [3, "Birth_Date", "TEXT", 0, null, 0], [4, "Height", "REAL", 0, null, 0]], "primary_keys": ["People_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "People_ID"]]], "check_constraints": []}} | CREATE TABLE poker_player (
Poker_Player_ID INT PRIMARY KEY,
People_ID INT,
Final_Table_Made REAL,
Best_Finish REAL,
Money_Rank REAL,
Earnings REAL,
UNIQUE (Poker_Player_ID),
FOREIGN KEY (People_ID) REFERENCES people(People_ID)
);
CREATE TABLE people (
People_ID INT PRIMARY KEY,
Nationality TEXT,
Name TEXT,
Birth_Date TEXT,
Height REAL,
UNIQUE (People_ID)
); |
student_assessment | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 1, null, 1], [1, "line_1", "VARCHAR(80)", 0, null, 0], [2, "line_2", "VARCHAR(80)", 0, null, 0], [3, "city", "VARCHAR(50)", 0, null, 0], [4, "zip_postcode", "CHAR(20)", 0, null, 0], [5, "state_province_county", "VARCHAR(50)", 0, null, 0], [6, "country", "VARCHAR(50)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "People": {"columns": [[0, "person_id", "INTEGER", 1, null, 1], [1, "first_name", "VARCHAR(255)", 0, null, 0], [2, "middle_name", "VARCHAR(255)", 0, null, 0], [3, "last_name", "VARCHAR(255)", 0, null, 0], [4, "cell_mobile_number", "VARCHAR(40)", 0, null, 0], [5, "email_address", "VARCHAR(40)", 0, null, 0], [6, "login_name", "VARCHAR(40)", 0, null, 0], [7, "password", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["person_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Students": {"columns": [[0, "student_id", "INTEGER", 1, null, 1], [1, "student_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["student_id"], "foreign_keys": [[0, 0, "People", "student_id", "person_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Courses": {"columns": [[0, "course_id", "VARCHAR(100)", 1, null, 1], [1, "course_name", "VARCHAR(120)", 0, null, 0], [2, "course_description", "VARCHAR(255)", 0, null, 0], [3, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["course_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "course_id"]]], "check_constraints": []}, "People_Addresses": {"columns": [[0, "person_address_id", "INTEGER", 1, null, 1], [1, "person_id", "INTEGER", 1, null, 0], [2, "address_id", "INTEGER", 1, null, 0], [3, "date_from", "DATETIME", 0, null, 0], [4, "date_to", "DATETIME", 0, null, 0]], "primary_keys": ["person_address_id"], "foreign_keys": [[0, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "People", "person_id", "person_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student_Course_Registrations": {"columns": [[0, "student_id", "INTEGER", 1, null, 1], [1, "course_id", "INTEGER", 1, null, 2], [2, "registration_date", "DATETIME", 1, null, 0]], "primary_keys": ["student_id", "course_id"], "foreign_keys": [[0, 0, "Courses", "course_id", "course_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "student_id"], [1, 1, "course_id"]]], "check_constraints": []}, "Student_Course_Attendance": {"columns": [[0, "student_id", "INTEGER", 1, null, 1], [1, "course_id", "INTEGER", 1, null, 2], [2, "date_of_attendance", "DATETIME", 1, null, 0]], "primary_keys": ["student_id", "course_id"], "foreign_keys": [[0, 0, "Student_Course_Registrations", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Student_Course_Registrations", "course_id", "course_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "student_id"], [1, 1, "course_id"]]], "check_constraints": []}, "Candidates": {"columns": [[0, "candidate_id", "INTEGER", 1, null, 1], [1, "candidate_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["candidate_id"], "foreign_keys": [[0, 0, "People", "candidate_id", "person_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Candidate_Assessments": {"columns": [[0, "candidate_id", "INTEGER", 1, null, 1], [1, "qualification", "CHAR(15)", 1, null, 2], [2, "assessment_date", "DATETIME", 1, null, 0], [3, "asessment_outcome_code", "CHAR(15)", 1, null, 0]], "primary_keys": ["candidate_id", "qualification"], "foreign_keys": [[0, 0, "Candidates", "candidate_id", "candidate_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "candidate_id"], [1, 1, "qualification"]]], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER NOT NULL PRIMARY KEY,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE People (
person_id INTEGER NOT NULL PRIMARY KEY,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40)
);
CREATE TABLE Students (
student_id INTEGER NOT NULL PRIMARY KEY,
student_details VARCHAR(255),
FOREIGN KEY (student_id) REFERENCES People(person_id)
);
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL PRIMARY KEY,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
UNIQUE (course_id)
);
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL PRIMARY KEY,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
FOREIGN KEY (address_id) REFERENCES Addresses(address_id),
FOREIGN KEY (person_id) REFERENCES People(person_id)
);
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL PRIMARY KEY,
course_id INTEGER NOT NULL PRIMARY KEY,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
UNIQUE (student_id, course_id),
FOREIGN KEY (course_id) REFERENCES Courses(course_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL PRIMARY KEY,
course_id INTEGER NOT NULL PRIMARY KEY,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
UNIQUE (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Student_Course_Registrations(student_id),
FOREIGN KEY (course_id) REFERENCES Student_Course_Registrations(course_id)
);
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL PRIMARY KEY,
candidate_details VARCHAR(255),
FOREIGN KEY (candidate_id) REFERENCES People(person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL PRIMARY KEY,
qualification CHAR(15) NOT NULL PRIMARY KEY,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
UNIQUE (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates(candidate_id)
); |
match_season | {"country": {"columns": [[0, "Country_id", "INT", 0, null, 1], [1, "Country_name", "TEXT", 0, null, 0], [2, "Capital", "TEXT", 0, null, 0], [3, "Official_native_language", "TEXT", 0, null, 0]], "primary_keys": ["Country_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Country_id"]]], "check_constraints": []}, "team": {"columns": [[0, "Team_id", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0]], "primary_keys": ["Team_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Team_id"]]], "check_constraints": []}, "match_season": {"columns": [[0, "Season", "REAL", 0, null, 1], [1, "Player", "TEXT", 0, null, 0], [2, "Position", "TEXT", 0, null, 0], [3, "Country", "INT", 0, null, 0], [4, "Team", "INT", 0, null, 0], [5, "Draft_Pick_Number", "INT", 0, null, 0], [6, "Draft_Class", "TEXT", 0, null, 0], [7, "College", "TEXT", 0, null, 0]], "primary_keys": ["Season"], "foreign_keys": [[0, 0, "team", "Team", "Team_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "country", "Country", "Country_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Season"]]], "check_constraints": []}, "player": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "Player", "TEXT", 0, null, 0], [2, "Years_Played", "TEXT", 0, null, 0], [3, "Total_WL", "TEXT", 0, null, 0], [4, "Singles_WL", "TEXT", 0, null, 0], [5, "Doubles_WL", "TEXT", 0, null, 0], [6, "Team", "INT", 0, null, 0]], "primary_keys": ["Player_ID"], "foreign_keys": [[0, 0, "team", "Team", "Team_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Player_ID"]]], "check_constraints": []}} | CREATE TABLE country (
Country_id INT PRIMARY KEY,
Country_name TEXT,
Capital TEXT,
Official_native_language TEXT,
UNIQUE (Country_id)
);
CREATE TABLE team (
Team_id INT PRIMARY KEY,
Name TEXT,
UNIQUE (Team_id)
);
CREATE TABLE match_season (
Season REAL PRIMARY KEY,
Player TEXT,
Position TEXT,
Country INT,
Team INT,
Draft_Pick_Number INT,
Draft_Class TEXT,
College TEXT,
UNIQUE (Season),
FOREIGN KEY (Team) REFERENCES team(Team_id),
FOREIGN KEY (Country) REFERENCES country(Country_id)
);
CREATE TABLE player (
Player_ID INT PRIMARY KEY,
Player TEXT,
Years_Played TEXT,
Total_WL TEXT,
Singles_WL TEXT,
Doubles_WL TEXT,
Team INT,
UNIQUE (Player_ID),
FOREIGN KEY (Team) REFERENCES team(Team_id)
); |
sakila_1 | {"actor": {"columns": [[0, "actor_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "first_name", "VARCHAR(45)", 1, null, 0], [2, "last_name", "VARCHAR(45)", 1, null, 0], [3, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["actor_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "actor_id"]]], "check_constraints": []}, "address": {"columns": [[0, "address_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "address", "VARCHAR(50)", 1, null, 0], [2, "address2", "VARCHAR(50)", 0, "NULL", 0], [3, "district", "VARCHAR(20)", 1, null, 0], [4, "city_id", "SMALLINT UNSIGNED", 1, null, 0], [5, "postal_code", "VARCHAR(10)", 0, "NULL", 0], [6, "phone", "VARCHAR(20)", 1, null, 0], [7, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["address_id"], "foreign_keys": [[0, 0, "city", "city_id", "city_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "address_id"]]], "check_constraints": []}, "category": {"columns": [[0, "category_id", "TINYINT UNSIGNED", 1, null, 1], [1, "name", "VARCHAR(25)", 1, null, 0], [2, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["category_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "category_id"]]], "check_constraints": []}, "city": {"columns": [[0, "city_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "city", "VARCHAR(50)", 1, null, 0], [2, "country_id", "SMALLINT UNSIGNED", 1, null, 0], [3, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["city_id"], "foreign_keys": [[0, 0, "country", "country_id", "country_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "city_id"]]], "check_constraints": []}, "country": {"columns": [[0, "country_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "country", "VARCHAR(50)", 1, null, 0], [2, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["country_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "country_id"]]], "check_constraints": []}, "customer": {"columns": [[0, "customer_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "store_id", "TINYINT UNSIGNED", 1, null, 0], [2, "first_name", "VARCHAR(45)", 1, null, 0], [3, "last_name", "VARCHAR(45)", 1, null, 0], [4, "email", "VARCHAR(50)", 0, "NULL", 0], [5, "address_id", "SMALLINT UNSIGNED", 1, null, 0], [6, "active", "BOOLEAN", 1, "TRUE", 0], [7, "create_date", "DATETIME", 1, null, 0], [8, "last_update", "TIMESTAMP", 0, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["customer_id"], "foreign_keys": [[0, 0, "store", "store_id", "store_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "address", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "customer_id"]]], "check_constraints": []}, "film": {"columns": [[0, "film_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "title", "VARCHAR(255)", 1, null, 0], [2, "description", "TEXT", 0, "NULL", 0], [3, "release_year", "YEAR", 0, "NULL", 0], [4, "language_id", "TINYINT UNSIGNED", 1, null, 0], [5, "original_language_id", "TINYINT UNSIGNED", 0, "NULL", 0], [6, "rental_duration", "TINYINT UNSIGNED", 1, "3", 0], [7, "rental_rate", "DECIMAL(4,2)", 1, "4.99", 0], [8, "length", "SMALLINT UNSIGNED", 0, "NULL", 0], [9, "replacement_cost", "DECIMAL(5,2)", 1, "19.99", 0], [10, "rating", "", 0, "'G'", 0], [11, "special_features", "", 0, "NULL", 0], [12, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["film_id"], "foreign_keys": [[0, 0, "language", "original_language_id", "language_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "language", "language_id", "language_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "film_id"]]], "check_constraints": []}, "film_actor": {"columns": [[0, "actor_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "film_id", "SMALLINT UNSIGNED", 1, null, 2], [2, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["actor_id", "film_id"], "foreign_keys": [[0, 0, "film", "film_id", "film_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "actor", "actor_id", "actor_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "actor_id"], [1, 1, "film_id"]]], "check_constraints": []}, "film_category": {"columns": [[0, "film_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "category_id", "TINYINT UNSIGNED", 1, null, 2], [2, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["film_id", "category_id"], "foreign_keys": [[0, 0, "category", "category_id", "category_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "film", "film_id", "film_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "film_id"], [1, 1, "category_id"]]], "check_constraints": []}, "film_text": {"columns": [[0, "film_id", "SMALLINT", 1, null, 1], [1, "title", "VARCHAR(255)", 1, null, 0], [2, "description", "TEXT", 0, null, 0]], "primary_keys": ["film_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "film_id"]]], "check_constraints": []}, "inventory": {"columns": [[0, "inventory_id", "MEDIUMINT UNSIGNED", 1, null, 1], [1, "film_id", "SMALLINT UNSIGNED", 1, null, 0], [2, "store_id", "TINYINT UNSIGNED", 1, null, 0], [3, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["inventory_id"], "foreign_keys": [[0, 0, "film", "film_id", "film_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "store", "store_id", "store_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "inventory_id"]]], "check_constraints": []}, "language": {"columns": [[0, "language_id", "TINYINT UNSIGNED", 1, null, 1], [1, "name", "CHAR(20)", 1, null, 0], [2, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["language_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "language_id"]]], "check_constraints": []}, "payment": {"columns": [[0, "payment_id", "SMALLINT UNSIGNED", 1, null, 1], [1, "customer_id", "SMALLINT UNSIGNED", 1, null, 0], [2, "staff_id", "TINYINT UNSIGNED", 1, null, 0], [3, "rental_id", "INT", 0, "NULL", 0], [4, "amount", "DECIMAL(5,2)", 1, null, 0], [5, "payment_date", "DATETIME", 1, null, 0], [6, "last_update", "TIMESTAMP", 0, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["payment_id"], "foreign_keys": [[0, 0, "staff", "staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "customer", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "rental", "rental_id", "rental_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "payment_id"]]], "check_constraints": []}, "rental": {"columns": [[0, "rental_id", "INT", 1, null, 1], [1, "rental_date", "DATETIME", 1, null, 0], [2, "inventory_id", "MEDIUMINT UNSIGNED", 1, null, 0], [3, "customer_id", "SMALLINT UNSIGNED", 1, null, 0], [4, "return_date", "DATETIME", 0, "NULL", 0], [5, "staff_id", "TINYINT UNSIGNED", 1, null, 0], [6, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["rental_id"], "foreign_keys": [[0, 0, "customer", "customer_id", "customer_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "inventory", "inventory_id", "inventory_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "staff", "staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "rental_id"]]], "check_constraints": []}, "staff": {"columns": [[0, "staff_id", "TINYINT UNSIGNED", 1, null, 1], [1, "first_name", "VARCHAR(45)", 1, null, 0], [2, "last_name", "VARCHAR(45)", 1, null, 0], [3, "address_id", "SMALLINT UNSIGNED", 1, null, 0], [4, "picture", "BLOB", 0, "NULL", 0], [5, "email", "VARCHAR(50)", 0, "NULL", 0], [6, "store_id", "TINYINT UNSIGNED", 1, null, 0], [7, "active", "BOOLEAN", 1, "TRUE", 0], [8, "username", "VARCHAR(16)", 1, null, 0], [9, "password", "VARCHAR(40)", 0, "NULL", 0], [10, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["staff_id"], "foreign_keys": [[0, 0, "address", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "staff_id"]]], "check_constraints": []}, "store": {"columns": [[0, "store_id", "TINYINT UNSIGNED", 1, null, 1], [1, "manager_staff_id", "TINYINT UNSIGNED", 1, null, 0], [2, "address_id", "SMALLINT UNSIGNED", 1, null, 0], [3, "last_update", "TIMESTAMP", 1, "CURRENT_TIMESTAMP", 0]], "primary_keys": ["store_id"], "foreign_keys": [[0, 0, "address", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "staff", "manager_staff_id", "staff_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "store_id"]]], "check_constraints": []}} | CREATE TABLE actor (
actor_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (actor_id)
);
CREATE TABLE address (
address_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
address VARCHAR(50) NOT NULL,
address2 VARCHAR(50) DEFAULT NULL,
district VARCHAR(20) NOT NULL,
city_id SMALLINT UNSIGNED NOT NULL,
postal_code VARCHAR(10) DEFAULT NULL,
phone VARCHAR(20) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (address_id),
FOREIGN KEY (city_id) REFERENCES city(city_id)
);
CREATE TABLE category (
category_id TINYINT UNSIGNED NOT NULL PRIMARY KEY,
name VARCHAR(25) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (category_id)
);
CREATE TABLE city (
city_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
city VARCHAR(50) NOT NULL,
country_id SMALLINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (city_id),
FOREIGN KEY (country_id) REFERENCES country(country_id)
);
CREATE TABLE country (
country_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
country VARCHAR(50) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (country_id)
);
CREATE TABLE customer (
customer_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
store_id TINYINT UNSIGNED NOT NULL,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
email VARCHAR(50) DEFAULT NULL,
address_id SMALLINT UNSIGNED NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
create_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE (customer_id),
FOREIGN KEY (store_id) REFERENCES store(store_id),
FOREIGN KEY (address_id) REFERENCES address(address_id)
);
CREATE TABLE film (
film_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year YEAR DEFAULT NULL,
language_id TINYINT UNSIGNED NOT NULL,
original_language_id TINYINT UNSIGNED DEFAULT NULL,
rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,
rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,
length SMALLINT UNSIGNED DEFAULT NULL,
replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,
rating DEFAULT 'G',
special_features DEFAULT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (film_id),
FOREIGN KEY (original_language_id) REFERENCES language(language_id),
FOREIGN KEY (language_id) REFERENCES language(language_id)
);
CREATE TABLE film_actor (
actor_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
film_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (actor_id, film_id),
UNIQUE (actor_id, film_id),
FOREIGN KEY (film_id) REFERENCES film(film_id),
FOREIGN KEY (actor_id) REFERENCES actor(actor_id)
);
CREATE TABLE film_category (
film_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
category_id TINYINT UNSIGNED NOT NULL PRIMARY KEY,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (film_id, category_id),
UNIQUE (film_id, category_id),
FOREIGN KEY (category_id) REFERENCES category(category_id),
FOREIGN KEY (film_id) REFERENCES film(film_id)
);
CREATE TABLE film_text (
film_id SMALLINT NOT NULL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
UNIQUE (film_id)
);
CREATE TABLE inventory (
inventory_id MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY,
film_id SMALLINT UNSIGNED NOT NULL,
store_id TINYINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (inventory_id),
FOREIGN KEY (film_id) REFERENCES film(film_id),
FOREIGN KEY (store_id) REFERENCES store(store_id)
);
CREATE TABLE language (
language_id TINYINT UNSIGNED NOT NULL PRIMARY KEY,
name CHAR(20) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (language_id)
);
CREATE TABLE payment (
payment_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY,
customer_id SMALLINT UNSIGNED NOT NULL,
staff_id TINYINT UNSIGNED NOT NULL,
rental_id INT DEFAULT NULL,
amount DECIMAL(5,2) NOT NULL,
payment_date DATETIME NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE (payment_id),
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
);
CREATE TABLE rental (
rental_id INT NOT NULL PRIMARY KEY,
rental_date DATETIME NOT NULL,
inventory_id MEDIUMINT UNSIGNED NOT NULL,
customer_id SMALLINT UNSIGNED NOT NULL,
return_date DATETIME DEFAULT NULL,
staff_id TINYINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (rental_id),
FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
FOREIGN KEY (inventory_id) REFERENCES inventory(inventory_id),
FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
);
CREATE TABLE staff (
staff_id TINYINT UNSIGNED NOT NULL PRIMARY KEY,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
address_id SMALLINT UNSIGNED NOT NULL,
picture BLOB DEFAULT NULL,
email VARCHAR(50) DEFAULT NULL,
store_id TINYINT UNSIGNED NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
username VARCHAR(16) NOT NULL,
password VARCHAR(40) DEFAULT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (staff_id),
FOREIGN KEY (address_id) REFERENCES address(address_id)
);
CREATE TABLE store (
store_id TINYINT UNSIGNED NOT NULL PRIMARY KEY,
manager_staff_id TINYINT UNSIGNED NOT NULL,
address_id SMALLINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (store_id),
FOREIGN KEY (address_id) REFERENCES address(address_id),
FOREIGN KEY (manager_staff_id) REFERENCES staff(staff_id)
); |
music_4 | {"artist": {"columns": [[0, "Artist_ID", "INT", 0, null, 1], [1, "Artist", "TEXT", 0, null, 0], [2, "Age", "INT", 0, null, 0], [3, "Famous_Title", "TEXT", 0, null, 0], [4, "Famous_Release_date", "TEXT", 0, null, 0]], "primary_keys": ["Artist_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Artist_ID"]]], "check_constraints": []}, "volume": {"columns": [[0, "Volume_ID", "INT", 0, null, 1], [1, "Volume_Issue", "TEXT", 0, null, 0], [2, "Issue_Date", "TEXT", 0, null, 0], [3, "Weeks_on_Top", "REAL", 0, null, 0], [4, "Song", "TEXT", 0, null, 0], [5, "Artist_ID", "INT", 0, null, 0]], "primary_keys": ["Volume_ID"], "foreign_keys": [[0, 0, "artist", "Artist_ID", "Artist_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Volume_ID"]]], "check_constraints": []}, "music_festival": {"columns": [[0, "ID", "INT", 0, null, 1], [1, "Music_Festival", "TEXT", 0, null, 0], [2, "Date_of_ceremony", "TEXT", 0, null, 0], [3, "Category", "TEXT", 0, null, 0], [4, "Volume", "INT", 0, null, 0], [5, "Result", "TEXT", 0, null, 0]], "primary_keys": ["ID"], "foreign_keys": [[0, 0, "volume", "Volume", "Volume_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "ID"]]], "check_constraints": []}} | CREATE TABLE artist (
Artist_ID INT PRIMARY KEY,
Artist TEXT,
Age INT,
Famous_Title TEXT,
Famous_Release_date TEXT,
UNIQUE (Artist_ID)
);
CREATE TABLE volume (
Volume_ID INT PRIMARY KEY,
Volume_Issue TEXT,
Issue_Date TEXT,
Weeks_on_Top REAL,
Song TEXT,
Artist_ID INT,
UNIQUE (Volume_ID),
FOREIGN KEY (Artist_ID) REFERENCES artist(Artist_ID)
);
CREATE TABLE music_festival (
ID INT PRIMARY KEY,
Music_Festival TEXT,
Date_of_ceremony TEXT,
Category TEXT,
Volume INT,
Result TEXT,
UNIQUE (ID),
FOREIGN KEY (Volume) REFERENCES volume(Volume_ID)
); |
cinema | {"film": {"columns": [[0, "Film_ID", "INT", 0, null, 1], [1, "Rank_in_series", "INT", 0, null, 0], [2, "Number_in_season", "INT", 0, null, 0], [3, "Title", "TEXT", 0, null, 0], [4, "Directed_by", "TEXT", 0, null, 0], [5, "Original_air_date", "TEXT", 0, null, 0], [6, "Production_code", "TEXT", 0, null, 0]], "primary_keys": ["Film_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Film_ID"]]], "check_constraints": []}, "cinema": {"columns": [[0, "Cinema_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Openning_year", "INT", 0, null, 0], [3, "Capacity", "INT", 0, null, 0], [4, "Location", "TEXT", 0, null, 0]], "primary_keys": ["Cinema_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Cinema_ID"]]], "check_constraints": []}, "schedule": {"columns": [[0, "Cinema_ID", "INT", 0, null, 1], [1, "Film_ID", "INT", 0, null, 2], [2, "Date", "TEXT", 0, null, 0], [3, "Show_times_per_day", "INT", 0, null, 0], [4, "Price", "float", 0, null, 0]], "primary_keys": ["Cinema_ID", "Film_ID"], "foreign_keys": [[0, 0, "cinema", "Cinema_ID", "Cinema_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "film", "Film_ID", "Film_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Cinema_ID"], [1, 1, "Film_ID"]]], "check_constraints": []}} | CREATE TABLE film (
Film_ID INT PRIMARY KEY,
Rank_in_series INT,
Number_in_season INT,
Title TEXT,
Directed_by TEXT,
Original_air_date TEXT,
Production_code TEXT,
UNIQUE (Film_ID)
);
CREATE TABLE cinema (
Cinema_ID INT PRIMARY KEY,
Name TEXT,
Openning_year INT,
Capacity INT,
Location TEXT,
UNIQUE (Cinema_ID)
);
CREATE TABLE schedule (
Cinema_ID INT PRIMARY KEY,
Film_ID INT PRIMARY KEY,
Date TEXT,
Show_times_per_day INT,
Price float,
PRIMARY KEY (Cinema_ID, Film_ID),
UNIQUE (Cinema_ID, Film_ID),
FOREIGN KEY (Cinema_ID) REFERENCES cinema(Cinema_ID),
FOREIGN KEY (Film_ID) REFERENCES film(Film_ID)
); |
program_share | {"program": {"columns": [[0, "Program_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Origin", "TEXT", 0, null, 0], [3, "Launch", "REAL", 0, null, 0], [4, "Owner", "TEXT", 0, null, 0]], "primary_keys": ["Program_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Program_ID"]]], "check_constraints": []}, "channel": {"columns": [[0, "Channel_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Owner", "TEXT", 0, null, 0], [3, "Share_in_percent", "REAL", 0, null, 0], [4, "Rating_in_percent", "REAL", 0, null, 0]], "primary_keys": ["Channel_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Channel_ID"]]], "check_constraints": []}, "broadcast": {"columns": [[0, "Channel_ID", "INT", 0, null, 1], [1, "Program_ID", "INT", 0, null, 2], [2, "Time_of_day", "TEXT", 0, null, 0]], "primary_keys": ["Channel_ID", "Program_ID"], "foreign_keys": [[0, 0, "program", "Program_ID", "Program_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "channel", "Channel_ID", "Channel_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Channel_ID"], [1, 1, "Program_ID"]]], "check_constraints": []}, "broadcast_share": {"columns": [[0, "Channel_ID", "INT", 0, null, 1], [1, "Program_ID", "INT", 0, null, 2], [2, "Date", "TEXT", 0, null, 0], [3, "Share_in_percent", "REAL", 0, null, 0]], "primary_keys": ["Channel_ID", "Program_ID"], "foreign_keys": [[0, 0, "program", "Program_ID", "Program_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "channel", "Channel_ID", "Channel_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Channel_ID"], [1, 1, "Program_ID"]]], "check_constraints": []}} | CREATE TABLE program (
Program_ID INT PRIMARY KEY,
Name TEXT,
Origin TEXT,
Launch REAL,
Owner TEXT,
UNIQUE (Program_ID)
);
CREATE TABLE channel (
Channel_ID INT PRIMARY KEY,
Name TEXT,
Owner TEXT,
Share_in_percent REAL,
Rating_in_percent REAL,
UNIQUE (Channel_ID)
);
CREATE TABLE broadcast (
Channel_ID INT PRIMARY KEY,
Program_ID INT PRIMARY KEY,
Time_of_day TEXT,
PRIMARY KEY (Channel_ID, Program_ID),
UNIQUE (Channel_ID, Program_ID),
FOREIGN KEY (Program_ID) REFERENCES program(Program_ID),
FOREIGN KEY (Channel_ID) REFERENCES channel(Channel_ID)
);
CREATE TABLE broadcast_share (
Channel_ID INT PRIMARY KEY,
Program_ID INT PRIMARY KEY,
Date TEXT,
Share_in_percent REAL,
PRIMARY KEY (Channel_ID, Program_ID),
UNIQUE (Channel_ID, Program_ID),
FOREIGN KEY (Program_ID) REFERENCES program(Program_ID),
FOREIGN KEY (Channel_ID) REFERENCES channel(Channel_ID)
); |
world_1 | {"city": {"columns": [[0, "ID", "INTEGER", 1, null, 1], [1, "Name", "char(35)", 1, "''", 0], [2, "CountryCode", "char(3)", 1, "''", 0], [3, "District", "char(20)", 1, "''", 0], [4, "Population", "INTEGER", 1, "'0'", 0]], "primary_keys": ["ID"], "foreign_keys": [[0, 0, "country", "CountryCode", "Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "sqlite_sequence": {"columns": [[0, "name", "", 0, null, 0], [1, "seq", "", 0, null, 0]], "primary_keys": [], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "country": {"columns": [[0, "Code", "char(3)", 1, "''", 1], [1, "Name", "char(52)", 1, "''", 0], [2, "Continent", "TEXT", 1, "'Asia'", 0], [3, "Region", "char(26)", 1, "''", 0], [4, "SurfaceArea", "float(10,2)", 1, "'0.00'", 0], [5, "IndepYear", "INTEGER", 0, "NULL", 0], [6, "Population", "INTEGER", 1, "'0'", 0], [7, "LifeExpectancy", "float(3,1)", 0, "NULL", 0], [8, "GNP", "float(10,2)", 0, "NULL", 0], [9, "GNPOld", "float(10,2)", 0, "NULL", 0], [10, "LocalName", "char(45)", 1, "''", 0], [11, "GovernmentForm", "char(45)", 1, "''", 0], [12, "HeadOfState", "char(60)", 0, "NULL", 0], [13, "Capital", "INTEGER", 0, "NULL", 0], [14, "Code2", "char(2)", 1, "''", 0]], "primary_keys": ["Code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Code"]]], "check_constraints": []}, "countrylanguage": {"columns": [[0, "CountryCode", "char(3)", 1, "''", 1], [1, "Language", "char(30)", 1, "''", 2], [2, "IsOfficial", "TEXT", 1, "'F'", 0], [3, "Percentage", "float(4,1)", 1, "'0.0'", 0]], "primary_keys": ["CountryCode", "Language"], "foreign_keys": [[0, 0, "country", "CountryCode", "Code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "CountryCode"], [1, 1, "Language"]]], "check_constraints": []}} | CREATE TABLE city (
ID INTEGER NOT NULL PRIMARY KEY,
Name char(35) NOT NULL DEFAULT '',
CountryCode char(3) NOT NULL DEFAULT '',
District char(20) NOT NULL DEFAULT '',
Population INTEGER NOT NULL DEFAULT '0',
FOREIGN KEY (CountryCode) REFERENCES country(Code)
);
CREATE TABLE sqlite_sequence (
name,
seq
);
CREATE TABLE country (
Code char(3) NOT NULL DEFAULT '' PRIMARY KEY,
Name char(52) NOT NULL DEFAULT '',
Continent TEXT NOT NULL DEFAULT 'Asia',
Region char(26) NOT NULL DEFAULT '',
SurfaceArea float(10,2) NOT NULL DEFAULT '0.00',
IndepYear INTEGER DEFAULT NULL,
Population INTEGER NOT NULL DEFAULT '0',
LifeExpectancy float(3,1) DEFAULT NULL,
GNP float(10,2) DEFAULT NULL,
GNPOld float(10,2) DEFAULT NULL,
LocalName char(45) NOT NULL DEFAULT '',
GovernmentForm char(45) NOT NULL DEFAULT '',
HeadOfState char(60) DEFAULT NULL,
Capital INTEGER DEFAULT NULL,
Code2 char(2) NOT NULL DEFAULT '',
UNIQUE (Code)
);
CREATE TABLE countrylanguage (
CountryCode char(3) NOT NULL DEFAULT '' PRIMARY KEY,
Language char(30) NOT NULL DEFAULT '' PRIMARY KEY,
IsOfficial TEXT NOT NULL DEFAULT 'F',
Percentage float(4,1) NOT NULL DEFAULT '0.0',
PRIMARY KEY (CountryCode, Language),
UNIQUE (CountryCode, Language),
FOREIGN KEY (CountryCode) REFERENCES country(Code)
); |
hr_1 | {"regions": {"columns": [[0, "REGION_ID", "decimal(5,0)", 1, null, 1], [1, "REGION_NAME", "varchar(25)", 0, "NULL", 0]], "primary_keys": ["REGION_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "REGION_ID"]]], "check_constraints": []}, "countries": {"columns": [[0, "COUNTRY_ID", "varchar(2)", 1, null, 1], [1, "COUNTRY_NAME", "varchar(40)", 0, "NULL", 0], [2, "REGION_ID", "decimal(10,0)", 0, "NULL", 0]], "primary_keys": ["COUNTRY_ID"], "foreign_keys": [[0, 0, "regions", "REGION_ID", "REGION_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "COUNTRY_ID"]]], "check_constraints": []}, "departments": {"columns": [[0, "DEPARTMENT_ID", "decimal(4,0)", 1, "'0'", 1], [1, "DEPARTMENT_NAME", "varchar(30)", 1, null, 0], [2, "MANAGER_ID", "decimal(6,0)", 0, "NULL", 0], [3, "LOCATION_ID", "decimal(4,0)", 0, "NULL", 0]], "primary_keys": ["DEPARTMENT_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "DEPARTMENT_ID"]]], "check_constraints": []}, "jobs": {"columns": [[0, "JOB_ID", "varchar(10)", 1, "''", 1], [1, "JOB_TITLE", "varchar(35)", 1, null, 0], [2, "MIN_SALARY", "decimal(6,0)", 0, "NULL", 0], [3, "MAX_SALARY", "decimal(6,0)", 0, "NULL", 0]], "primary_keys": ["JOB_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "JOB_ID"]]], "check_constraints": []}, "employees": {"columns": [[0, "EMPLOYEE_ID", "decimal(6,0)", 1, "'0'", 1], [1, "FIRST_NAME", "varchar(20)", 0, "NULL", 0], [2, "LAST_NAME", "varchar(25)", 1, null, 0], [3, "EMAIL", "varchar(25)", 1, null, 0], [4, "PHONE_NUMBER", "varchar(20)", 0, "NULL", 0], [5, "HIRE_DATE", "date", 1, null, 0], [6, "JOB_ID", "varchar(10)", 1, null, 0], [7, "SALARY", "decimal(8,2)", 0, "NULL", 0], [8, "COMMISSION_PCT", "decimal(2,2)", 0, "NULL", 0], [9, "MANAGER_ID", "decimal(6,0)", 0, "NULL", 0], [10, "DEPARTMENT_ID", "decimal(4,0)", 0, "NULL", 0]], "primary_keys": ["EMPLOYEE_ID"], "foreign_keys": [[0, 0, "jobs", "JOB_ID", "JOB_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "departments", "DEPARTMENT_ID", "DEPARTMENT_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "EMPLOYEE_ID"]]], "check_constraints": []}, "job_history": {"columns": [[0, "EMPLOYEE_ID", "decimal(6,0)", 1, null, 1], [1, "START_DATE", "date", 1, null, 2], [2, "END_DATE", "date", 1, null, 0], [3, "JOB_ID", "varchar(10)", 1, null, 0], [4, "DEPARTMENT_ID", "decimal(4,0)", 0, "NULL", 0]], "primary_keys": ["EMPLOYEE_ID", "START_DATE"], "foreign_keys": [[0, 0, "jobs", "JOB_ID", "JOB_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "departments", "DEPARTMENT_ID", "DEPARTMENT_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "employees", "EMPLOYEE_ID", "EMPLOYEE_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "EMPLOYEE_ID"], [1, 1, "START_DATE"]]], "check_constraints": []}, "locations": {"columns": [[0, "LOCATION_ID", "decimal(4,0)", 1, "'0'", 1], [1, "STREET_ADDRESS", "varchar(40)", 0, "NULL", 0], [2, "POSTAL_CODE", "varchar(12)", 0, "NULL", 0], [3, "CITY", "varchar(30)", 1, null, 0], [4, "STATE_PROVINCE", "varchar(25)", 0, "NULL", 0], [5, "COUNTRY_ID", "varchar(2)", 0, "NULL", 0]], "primary_keys": ["LOCATION_ID"], "foreign_keys": [[0, 0, "countries", "COUNTRY_ID", "COUNTRY_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "LOCATION_ID"]]], "check_constraints": []}} | CREATE TABLE regions (
REGION_ID decimal(5,0) NOT NULL PRIMARY KEY,
REGION_NAME varchar(25) DEFAULT NULL,
UNIQUE (REGION_ID)
);
CREATE TABLE countries (
COUNTRY_ID varchar(2) NOT NULL PRIMARY KEY,
COUNTRY_NAME varchar(40) DEFAULT NULL,
REGION_ID decimal(10,0) DEFAULT NULL,
UNIQUE (COUNTRY_ID),
FOREIGN KEY (REGION_ID) REFERENCES regions(REGION_ID)
);
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0) NOT NULL DEFAULT '0' PRIMARY KEY,
DEPARTMENT_NAME varchar(30) NOT NULL,
MANAGER_ID decimal(6,0) DEFAULT NULL,
LOCATION_ID decimal(4,0) DEFAULT NULL,
UNIQUE (DEPARTMENT_ID)
);
CREATE TABLE jobs (
JOB_ID varchar(10) NOT NULL DEFAULT '' PRIMARY KEY,
JOB_TITLE varchar(35) NOT NULL,
MIN_SALARY decimal(6,0) DEFAULT NULL,
MAX_SALARY decimal(6,0) DEFAULT NULL,
UNIQUE (JOB_ID)
);
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0) NOT NULL DEFAULT '0' PRIMARY KEY,
FIRST_NAME varchar(20) DEFAULT NULL,
LAST_NAME varchar(25) NOT NULL,
EMAIL varchar(25) NOT NULL,
PHONE_NUMBER varchar(20) DEFAULT NULL,
HIRE_DATE date NOT NULL,
JOB_ID varchar(10) NOT NULL,
SALARY decimal(8,2) DEFAULT NULL,
COMMISSION_PCT decimal(2,2) DEFAULT NULL,
MANAGER_ID decimal(6,0) DEFAULT NULL,
DEPARTMENT_ID decimal(4,0) DEFAULT NULL,
UNIQUE (EMPLOYEE_ID),
FOREIGN KEY (JOB_ID) REFERENCES jobs(JOB_ID),
FOREIGN KEY (DEPARTMENT_ID) REFERENCES departments(DEPARTMENT_ID)
);
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0) NOT NULL PRIMARY KEY,
START_DATE date NOT NULL PRIMARY KEY,
END_DATE date NOT NULL,
JOB_ID varchar(10) NOT NULL,
DEPARTMENT_ID decimal(4,0) DEFAULT NULL,
PRIMARY KEY (EMPLOYEE_ID, START_DATE),
UNIQUE (EMPLOYEE_ID, START_DATE),
FOREIGN KEY (JOB_ID) REFERENCES jobs(JOB_ID),
FOREIGN KEY (DEPARTMENT_ID) REFERENCES departments(DEPARTMENT_ID),
FOREIGN KEY (EMPLOYEE_ID) REFERENCES employees(EMPLOYEE_ID)
);
CREATE TABLE locations (
LOCATION_ID decimal(4,0) NOT NULL DEFAULT '0' PRIMARY KEY,
STREET_ADDRESS varchar(40) DEFAULT NULL,
POSTAL_CODE varchar(12) DEFAULT NULL,
CITY varchar(30) NOT NULL,
STATE_PROVINCE varchar(25) DEFAULT NULL,
COUNTRY_ID varchar(2) DEFAULT NULL,
UNIQUE (LOCATION_ID),
FOREIGN KEY (COUNTRY_ID) REFERENCES countries(COUNTRY_ID)
); |
e_learning | {"Course_Authors_and_Tutors": {"columns": [[0, "author_id", "INTEGER", 0, null, 1], [1, "author_tutor_ATB", "VARCHAR(3)", 0, null, 0], [2, "login_name", "VARCHAR(40)", 0, null, 0], [3, "password", "VARCHAR(40)", 0, null, 0], [4, "personal_name", "VARCHAR(80)", 0, null, 0], [5, "middle_name", "VARCHAR(80)", 0, null, 0], [6, "family_name", "VARCHAR(80)", 0, null, 0], [7, "gender_mf", "VARCHAR(1)", 0, null, 0], [8, "address_line_1", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["author_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Students": {"columns": [[0, "student_id", "INTEGER", 0, null, 1], [1, "date_of_registration", "DATETIME", 0, null, 0], [2, "date_of_latest_logon", "DATETIME", 0, null, 0], [3, "login_name", "VARCHAR(40)", 0, null, 0], [4, "password", "VARCHAR(10)", 0, null, 0], [5, "personal_name", "VARCHAR(40)", 0, null, 0], [6, "middle_name", "VARCHAR(40)", 0, null, 0], [7, "family_name", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["student_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Subjects": {"columns": [[0, "subject_id", "INTEGER", 0, null, 1], [1, "subject_name", "VARCHAR(120)", 0, null, 0]], "primary_keys": ["subject_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Courses": {"columns": [[0, "course_id", "INTEGER", 0, null, 1], [1, "author_id", "INTEGER", 1, null, 0], [2, "subject_id", "INTEGER", 1, null, 0], [3, "course_name", "VARCHAR(120)", 0, null, 0], [4, "course_description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["course_id"], "foreign_keys": [[0, 0, "Subjects", "subject_id", "subject_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Course_Authors_and_Tutors", "author_id", "author_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student_Course_Enrolment": {"columns": [[0, "registration_id", "INTEGER", 0, null, 1], [1, "student_id", "INTEGER", 1, null, 0], [2, "course_id", "INTEGER", 1, null, 0], [3, "date_of_enrolment", "DATETIME", 1, null, 0], [4, "date_of_completion", "DATETIME", 1, null, 0]], "primary_keys": ["registration_id"], "foreign_keys": [[0, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Courses", "course_id", "course_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student_Tests_Taken": {"columns": [[0, "registration_id", "INTEGER", 1, null, 0], [1, "date_test_taken", "DATETIME", 1, null, 0], [2, "test_result", "VARCHAR(255)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Student_Course_Enrolment", "registration_id", "registration_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER PRIMARY KEY,
author_tutor_ATB VARCHAR(3),
login_name VARCHAR(40),
password VARCHAR(40),
personal_name VARCHAR(80),
middle_name VARCHAR(80),
family_name VARCHAR(80),
gender_mf VARCHAR(1),
address_line_1 VARCHAR(80)
);
CREATE TABLE Students (
student_id INTEGER PRIMARY KEY,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
);
CREATE TABLE Subjects (
subject_id INTEGER PRIMARY KEY,
subject_name VARCHAR(120)
);
CREATE TABLE Courses (
course_id INTEGER PRIMARY KEY,
author_id INTEGER NOT NULL,
subject_id INTEGER NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
FOREIGN KEY (subject_id) REFERENCES Subjects(subject_id),
FOREIGN KEY (author_id) REFERENCES Course_Authors_and_Tutors(author_id)
);
CREATE TABLE Student_Course_Enrolment (
registration_id INTEGER PRIMARY KEY,
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_enrolment DATETIME NOT NULL,
date_of_completion DATETIME NOT NULL,
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (course_id) REFERENCES Courses(course_id)
);
CREATE TABLE Student_Tests_Taken (
registration_id INTEGER NOT NULL,
date_test_taken DATETIME NOT NULL,
test_result VARCHAR(255),
FOREIGN KEY (registration_id) REFERENCES Student_Course_Enrolment(registration_id)
); |
icfp_1 | {"Inst": {"columns": [[0, "instID", "INTEGER", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "country", "TEXT", 0, null, 0]], "primary_keys": ["instID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Authors": {"columns": [[0, "authID", "INTEGER", 0, null, 1], [1, "lname", "TEXT", 0, null, 0], [2, "fname", "TEXT", 0, null, 0]], "primary_keys": ["authID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Papers": {"columns": [[0, "paperID", "INTEGER", 0, null, 1], [1, "title", "TEXT", 0, null, 0]], "primary_keys": ["paperID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Authorship": {"columns": [[0, "authID", "INTEGER", 0, null, 1], [1, "instID", "INTEGER", 0, null, 2], [2, "paperID", "INTEGER", 0, null, 3], [3, "authOrder", "INTEGER", 0, null, 0]], "primary_keys": ["authID", "instID", "paperID"], "foreign_keys": [[0, 0, "Papers", "paperID", "paperID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Inst", "instID", "instID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Authors", "authID", "authID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "authID"], [1, 1, "instID"], [2, 2, "paperID"]]], "check_constraints": []}} | CREATE TABLE Inst (
instID INTEGER PRIMARY KEY,
name TEXT,
country TEXT
);
CREATE TABLE Authors (
authID INTEGER PRIMARY KEY,
lname TEXT,
fname TEXT
);
CREATE TABLE Papers (
paperID INTEGER PRIMARY KEY,
title TEXT
);
CREATE TABLE Authorship (
authID INTEGER PRIMARY KEY,
instID INTEGER PRIMARY KEY,
paperID INTEGER PRIMARY KEY,
authOrder INTEGER,
PRIMARY KEY (authID, instID, paperID),
UNIQUE (authID, instID, paperID),
FOREIGN KEY (paperID) REFERENCES Papers(paperID),
FOREIGN KEY (instID) REFERENCES Inst(instID),
FOREIGN KEY (authID) REFERENCES Authors(authID)
); |
customers_card_transactions | {"Accounts": {"columns": [[0, "account_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "account_name", "VARCHAR(50)", 0, null, 0], [3, "other_account_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["account_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers": {"columns": [[0, "customer_id", "INTEGER", 0, null, 1], [1, "customer_first_name", "VARCHAR(20)", 0, null, 0], [2, "customer_last_name", "VARCHAR(20)", 0, null, 0], [3, "customer_address", "VARCHAR(255)", 0, null, 0], [4, "customer_phone", "VARCHAR(255)", 0, null, 0], [5, "customer_email", "VARCHAR(255)", 0, null, 0], [6, "other_customer_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["customer_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Customers_Cards": {"columns": [[0, "card_id", "INTEGER", 0, null, 1], [1, "customer_id", "INTEGER", 1, null, 0], [2, "card_type_code", "VARCHAR(15)", 1, null, 0], [3, "card_number", "VARCHAR(80)", 0, null, 0], [4, "date_valid_from", "DATETIME", 0, null, 0], [5, "date_valid_to", "DATETIME", 0, null, 0], [6, "other_card_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["card_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Financial_Transactions": {"columns": [[0, "transaction_id", "INTEGER", 1, null, 0], [1, "previous_transaction_id", "INTEGER", 0, null, 0], [2, "account_id", "INTEGER", 1, null, 0], [3, "card_id", "INTEGER", 1, null, 0], [4, "transaction_type", "VARCHAR(15)", 1, null, 0], [5, "transaction_date", "DATETIME", 0, null, 0], [6, "transaction_amount", "DOUBLE", 0, null, 0], [7, "transaction_comment", "VARCHAR(255)", 0, null, 0], [8, "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, "Customers_Cards", "card_id", "card_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Accounts (
account_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
);
CREATE TABLE Customers (
customer_id INTEGER PRIMARY KEY,
customer_first_name VARCHAR(20),
customer_last_name VARCHAR(20),
customer_address VARCHAR(255),
customer_phone VARCHAR(255),
customer_email VARCHAR(255),
other_customer_details VARCHAR(255)
);
CREATE TABLE Customers_Cards (
card_id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
card_type_code VARCHAR(15) NOT NULL,
card_number VARCHAR(80),
date_valid_from DATETIME,
date_valid_to DATETIME,
other_card_details VARCHAR(255)
);
CREATE TABLE Financial_Transactions (
transaction_id INTEGER NOT NULL,
previous_transaction_id INTEGER,
account_id INTEGER NOT NULL,
card_id INTEGER NOT NULL,
transaction_type VARCHAR(15) NOT NULL,
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(255),
FOREIGN KEY (account_id) REFERENCES Accounts(account_id),
FOREIGN KEY (card_id) REFERENCES Customers_Cards(card_id)
); |
behavior_monitoring | {"Ref_Address_Types": {"columns": [[0, "address_type_code", "VARCHAR(15)", 0, null, 1], [1, "address_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["address_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "address_type_code"]]], "check_constraints": []}, "Ref_Detention_Type": {"columns": [[0, "detention_type_code", "VARCHAR(10)", 0, null, 1], [1, "detention_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["detention_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "detention_type_code"]]], "check_constraints": []}, "Ref_Incident_Type": {"columns": [[0, "incident_type_code", "VARCHAR(10)", 0, null, 1], [1, "incident_type_description", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["incident_type_code"], "foreign_keys": [], "unique_constraints": [[[0, 0, "incident_type_code"]]], "check_constraints": []}, "Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "line_1", "VARCHAR(120)", 0, null, 0], [2, "line_2", "VARCHAR(120)", 0, null, 0], [3, "line_3", "VARCHAR(120)", 0, null, 0], [4, "city", "VARCHAR(80)", 0, null, 0], [5, "zip_postcode", "VARCHAR(20)", 0, null, 0], [6, "state_province_county", "VARCHAR(50)", 0, null, 0], [7, "country", "VARCHAR(50)", 0, null, 0], [8, "other_address_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["address_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Students": {"columns": [[0, "student_id", "INTEGER", 0, null, 1], [1, "address_id", "INTEGER", 1, null, 0], [2, "first_name", "VARCHAR(80)", 0, null, 0], [3, "middle_name", "VARCHAR(40)", 0, null, 0], [4, "last_name", "VARCHAR(40)", 0, null, 0], [5, "cell_mobile_number", "VARCHAR(40)", 0, null, 0], [6, "email_address", "VARCHAR(40)", 0, null, 0], [7, "date_first_rental", "DATETIME", 0, null, 0], [8, "date_left_university", "DATETIME", 0, null, 0], [9, "other_student_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["student_id"], "foreign_keys": [[0, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Teachers": {"columns": [[0, "teacher_id", "INTEGER", 0, null, 1], [1, "address_id", "INTEGER", 1, null, 0], [2, "first_name", "VARCHAR(80)", 0, null, 0], [3, "middle_name", "VARCHAR(80)", 0, null, 0], [4, "last_name", "VARCHAR(80)", 0, null, 0], [5, "gender", "VARCHAR(1)", 0, null, 0], [6, "cell_mobile_number", "VARCHAR(40)", 0, null, 0], [7, "email_address", "VARCHAR(40)", 0, null, 0], [8, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["teacher_id"], "foreign_keys": [[0, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Assessment_Notes": {"columns": [[0, "notes_id", "INTEGER", 1, null, 0], [1, "student_id", "INTEGER", 0, null, 0], [2, "teacher_id", "INTEGER", 1, null, 0], [3, "date_of_notes", "DATETIME", 0, null, 0], [4, "text_of_notes", "VARCHAR(255)", 0, null, 0], [5, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Teachers", "teacher_id", "teacher_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Behavior_Incident": {"columns": [[0, "incident_id", "INTEGER", 0, null, 1], [1, "incident_type_code", "VARCHAR(10)", 1, null, 0], [2, "student_id", "INTEGER", 1, null, 0], [3, "date_incident_start", "DATETIME", 0, null, 0], [4, "date_incident_end", "DATETIME", 0, null, 0], [5, "incident_summary", "VARCHAR(255)", 0, null, 0], [6, "recommendations", "VARCHAR(255)", 0, null, 0], [7, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["incident_id"], "foreign_keys": [[0, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Incident_Type", "incident_type_code", "incident_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Detention": {"columns": [[0, "detention_id", "INTEGER", 0, null, 1], [1, "detention_type_code", "VARCHAR(10)", 1, null, 0], [2, "teacher_id", "INTEGER", 0, null, 0], [3, "datetime_detention_start", "DATETIME", 0, null, 0], [4, "datetime_detention_end", "DATETIME", 0, null, 0], [5, "detention_summary", "VARCHAR(255)", 0, null, 0], [6, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["detention_id"], "foreign_keys": [[0, 0, "Teachers", "teacher_id", "teacher_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Ref_Detention_Type", "detention_type_code", "detention_type_code", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Student_Addresses": {"columns": [[0, "student_id", "INTEGER", 1, null, 0], [1, "address_id", "INTEGER", 1, null, 0], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "date_address_to", "DATETIME", 0, null, 0], [4, "monthly_rental", "DECIMAL(19,4)", 0, null, 0], [5, "other_details", "VARCHAR(255)", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Students_in_Detention": {"columns": [[0, "student_id", "INTEGER", 1, null, 0], [1, "detention_id", "INTEGER", 1, null, 0], [2, "incident_id", "INTEGER", 1, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Students", "student_id", "student_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Detention", "detention_id", "detention_id", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "Behavior_Incident", "incident_id", "incident_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Ref_Address_Types (
address_type_code VARCHAR(15) PRIMARY KEY,
address_type_description VARCHAR(80),
UNIQUE (address_type_code)
);
CREATE TABLE Ref_Detention_Type (
detention_type_code VARCHAR(10) PRIMARY KEY,
detention_type_description VARCHAR(80),
UNIQUE (detention_type_code)
);
CREATE TABLE Ref_Incident_Type (
incident_type_code VARCHAR(10) PRIMARY KEY,
incident_type_description VARCHAR(80),
UNIQUE (incident_type_code)
);
CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
line_1 VARCHAR(120),
line_2 VARCHAR(120),
line_3 VARCHAR(120),
city VARCHAR(80),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
other_address_details VARCHAR(255)
);
CREATE TABLE Students (
student_id INTEGER PRIMARY KEY,
address_id INTEGER NOT NULL,
first_name VARCHAR(80),
middle_name VARCHAR(40),
last_name VARCHAR(40),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
date_first_rental DATETIME,
date_left_university DATETIME,
other_student_details VARCHAR(255),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Teachers (
teacher_id INTEGER PRIMARY KEY,
address_id INTEGER NOT NULL,
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
gender VARCHAR(1),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
other_details VARCHAR(255),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Assessment_Notes (
notes_id INTEGER NOT NULL,
student_id INTEGER,
teacher_id INTEGER NOT NULL,
date_of_notes DATETIME,
text_of_notes VARCHAR(255),
other_details VARCHAR(255),
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (student_id) REFERENCES Students(student_id)
);
CREATE TABLE Behavior_Incident (
incident_id INTEGER PRIMARY KEY,
incident_type_code VARCHAR(10) NOT NULL,
student_id INTEGER NOT NULL,
date_incident_start DATETIME,
date_incident_end DATETIME,
incident_summary VARCHAR(255),
recommendations VARCHAR(255),
other_details VARCHAR(255),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (incident_type_code) REFERENCES Ref_Incident_Type(incident_type_code)
);
CREATE TABLE Detention (
detention_id INTEGER PRIMARY KEY,
detention_type_code VARCHAR(10) NOT NULL,
teacher_id INTEGER,
datetime_detention_start DATETIME,
datetime_detention_end DATETIME,
detention_summary VARCHAR(255),
other_details VARCHAR(255),
FOREIGN KEY (teacher_id) REFERENCES Teachers(teacher_id),
FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type(detention_type_code)
);
CREATE TABLE Student_Addresses (
student_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_address_from DATETIME NOT NULL,
date_address_to DATETIME,
monthly_rental DECIMAL(19,4),
other_details VARCHAR(255),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Students_in_Detention (
student_id INTEGER NOT NULL,
detention_id INTEGER NOT NULL,
incident_id INTEGER NOT NULL,
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (detention_id) REFERENCES Detention(detention_id),
FOREIGN KEY (incident_id) REFERENCES Behavior_Incident(incident_id)
); |
protein_institute | {"building": {"columns": [[0, "building_id", "TEXT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Street_address", "TEXT", 0, null, 0], [3, "Years_as_tallest", "TEXT", 0, null, 0], [4, "Height_feet", "INT", 0, null, 0], [5, "Floors", "INT", 0, null, 0]], "primary_keys": ["building_id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "building_id"]]], "check_constraints": []}, "Institution": {"columns": [[0, "Institution_id", "TEXT", 0, null, 1], [1, "Institution", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Founded", "REAL", 0, null, 0], [4, "Type", "TEXT", 0, null, 0], [5, "Enrollment", "INT", 0, null, 0], [6, "Team", "TEXT", 0, null, 0], [7, "Primary_Conference", "TEXT", 0, null, 0], [8, "building_id", "TEXT", 0, null, 0]], "primary_keys": ["Institution_id"], "foreign_keys": [[0, 0, "building", "building_id", "building_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Institution_id"]]], "check_constraints": []}, "protein": {"columns": [[0, "common_name", "TEXT", 0, null, 1], [1, "protein_name", "TEXT", 0, null, 0], [2, "divergence_from_human_lineage", "REAL", 0, null, 0], [3, "accession_number", "TEXT", 0, null, 0], [4, "sequence_length", "REAL", 0, null, 0], [5, "sequence_identity_to_human_protein", "TEXT", 0, null, 0], [6, "Institution_id", "TEXT", 0, null, 0]], "primary_keys": ["common_name"], "foreign_keys": [[0, 0, "Institution", "Institution_id", "Institution_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "common_name"]]], "check_constraints": []}} | CREATE TABLE building (
building_id TEXT PRIMARY KEY,
Name TEXT,
Street_address TEXT,
Years_as_tallest TEXT,
Height_feet INT,
Floors INT,
UNIQUE (building_id)
);
CREATE TABLE Institution (
Institution_id TEXT PRIMARY KEY,
Institution TEXT,
Location TEXT,
Founded REAL,
Type TEXT,
Enrollment INT,
Team TEXT,
Primary_Conference TEXT,
building_id TEXT,
UNIQUE (Institution_id),
FOREIGN KEY (building_id) REFERENCES building(building_id)
);
CREATE TABLE protein (
common_name TEXT PRIMARY KEY,
protein_name TEXT,
divergence_from_human_lineage REAL,
accession_number TEXT,
sequence_length REAL,
sequence_identity_to_human_protein TEXT,
Institution_id TEXT,
UNIQUE (common_name),
FOREIGN KEY (Institution_id) REFERENCES Institution(Institution_id)
); |
e_government | {"Addresses": {"columns": [[0, "address_id", "INTEGER", 0, null, 1], [1, "line_1_number_building", "VARCHAR(80)", 0, null, 0], [2, "town_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": []}, "Services": {"columns": [[0, "service_id", "INTEGER", 0, null, 1], [1, "service_type_code", "VARCHAR(15)", 1, null, 0], [2, "service_name", "VARCHAR(80)", 0, null, 0], [3, "service_descriptio", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["service_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Forms": {"columns": [[0, "form_id", "INTEGER", 0, null, 1], [1, "form_type_code", "VARCHAR(15)", 1, null, 0], [2, "service_id", "INTEGER", 0, null, 0], [3, "form_number", "VARCHAR(50)", 0, null, 0], [4, "form_name", "VARCHAR(80)", 0, null, 0], [5, "form_description", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["form_id"], "foreign_keys": [[0, 0, "Services", "service_id", "service_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}, "Individuals": {"columns": [[0, "individual_id", "INTEGER", 0, null, 1], [1, "individual_first_name", "VARCHAR(80)", 0, null, 0], [2, "individual_middle_name", "VARCHAR(80)", 0, null, 0], [3, "inidividual_phone", "VARCHAR(80)", 0, null, 0], [4, "individual_email", "VARCHAR(80)", 0, null, 0], [5, "individual_address", "VARCHAR(255)", 0, null, 0], [6, "individual_last_name", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["individual_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Organizations": {"columns": [[0, "organization_id", "INTEGER", 0, null, 1], [1, "date_formed", "DATETIME", 0, null, 0], [2, "organization_name", "VARCHAR(255)", 0, null, 0], [3, "uk_vat_number", "VARCHAR(20)", 0, null, 0]], "primary_keys": ["organization_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Parties": {"columns": [[0, "party_id", "INTEGER", 0, null, 1], [1, "payment_method_code", "VARCHAR(15)", 1, null, 0], [2, "party_phone", "VARCHAR(80)", 0, null, 0], [3, "party_email", "VARCHAR(80)", 0, null, 0]], "primary_keys": ["party_id"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Organization_Contact_Individuals": {"columns": [[0, "individual_id", "INTEGER", 1, null, 1], [1, "organization_id", "INTEGER", 1, null, 2], [2, "date_contact_from", "DATETIME", 1, null, 0], [3, "date_contact_to", "DATETIME", 0, null, 0]], "primary_keys": ["individual_id", "organization_id"], "foreign_keys": [[0, 0, "Individuals", "individual_id", "individual_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Organizations", "organization_id", "organization_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "individual_id"], [1, 1, "organization_id"]]], "check_constraints": []}, "Party_Addresses": {"columns": [[0, "party_id", "INTEGER", 1, null, 1], [1, "address_id", "INTEGER", 1, null, 2], [2, "date_address_from", "DATETIME", 1, null, 0], [3, "address_type_code", "VARCHAR(15)", 1, null, 0], [4, "date_address_to", "DATETIME", 0, null, 0]], "primary_keys": ["party_id", "address_id"], "foreign_keys": [[0, 0, "Parties", "party_id", "party_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Addresses", "address_id", "address_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "party_id"], [1, 1, "address_id"]]], "check_constraints": []}, "Party_Forms": {"columns": [[0, "party_id", "INTEGER", 1, null, 1], [1, "form_id", "INTEGER", 1, null, 2], [2, "date_completion_started", "DATETIME", 1, null, 0], [3, "form_status_code", "VARCHAR(15)", 1, null, 0], [4, "date_fully_completed", "DATETIME", 0, null, 0]], "primary_keys": ["party_id", "form_id"], "foreign_keys": [[0, 0, "Forms", "form_id", "form_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, "form_id"]]], "check_constraints": []}, "Party_Services": {"columns": [[0, "booking_id", "INTEGER", 1, null, 0], [1, "customer_id", "INTEGER", 1, null, 0], [2, "service_id", "INTEGER", 1, null, 0], [3, "service_datetime", "DATETIME", 1, null, 0], [4, "booking_made_date", "DATETIME", 0, null, 0]], "primary_keys": [], "foreign_keys": [[0, 0, "Parties", "customer_id", "party_id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Services", "service_id", "service_id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [], "check_constraints": []}} | CREATE TABLE Addresses (
address_id INTEGER PRIMARY KEY,
line_1_number_building VARCHAR(80),
town_city VARCHAR(50),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50)
);
CREATE TABLE Services (
service_id INTEGER PRIMARY KEY,
service_type_code VARCHAR(15) NOT NULL,
service_name VARCHAR(80),
service_descriptio VARCHAR(255)
);
CREATE TABLE Forms (
form_id INTEGER PRIMARY KEY,
form_type_code VARCHAR(15) NOT NULL,
service_id INTEGER,
form_number VARCHAR(50),
form_name VARCHAR(80),
form_description VARCHAR(255),
FOREIGN KEY (service_id) REFERENCES Services(service_id)
);
CREATE TABLE Individuals (
individual_id INTEGER PRIMARY KEY,
individual_first_name VARCHAR(80),
individual_middle_name VARCHAR(80),
inidividual_phone VARCHAR(80),
individual_email VARCHAR(80),
individual_address VARCHAR(255),
individual_last_name VARCHAR(80)
);
CREATE TABLE Organizations (
organization_id INTEGER PRIMARY KEY,
date_formed DATETIME,
organization_name VARCHAR(255),
uk_vat_number VARCHAR(20)
);
CREATE TABLE Parties (
party_id INTEGER PRIMARY KEY,
payment_method_code VARCHAR(15) NOT NULL,
party_phone VARCHAR(80),
party_email VARCHAR(80)
);
CREATE TABLE Organization_Contact_Individuals (
individual_id INTEGER NOT NULL PRIMARY KEY,
organization_id INTEGER NOT NULL PRIMARY KEY,
date_contact_from DATETIME NOT NULL,
date_contact_to DATETIME,
PRIMARY KEY (individual_id, organization_id),
UNIQUE (individual_id, organization_id),
FOREIGN KEY (individual_id) REFERENCES Individuals(individual_id),
FOREIGN KEY (organization_id) REFERENCES Organizations(organization_id)
);
CREATE TABLE Party_Addresses (
party_id INTEGER NOT NULL PRIMARY KEY,
address_id INTEGER NOT NULL PRIMARY KEY,
date_address_from DATETIME NOT NULL,
address_type_code VARCHAR(15) NOT NULL,
date_address_to DATETIME,
PRIMARY KEY (party_id, address_id),
UNIQUE (party_id, address_id),
FOREIGN KEY (party_id) REFERENCES Parties(party_id),
FOREIGN KEY (address_id) REFERENCES Addresses(address_id)
);
CREATE TABLE Party_Forms (
party_id INTEGER NOT NULL PRIMARY KEY,
form_id INTEGER NOT NULL PRIMARY KEY,
date_completion_started DATETIME NOT NULL,
form_status_code VARCHAR(15) NOT NULL,
date_fully_completed DATETIME,
PRIMARY KEY (party_id, form_id),
UNIQUE (party_id, form_id),
FOREIGN KEY (form_id) REFERENCES Forms(form_id),
FOREIGN KEY (party_id) REFERENCES Parties(party_id)
);
CREATE TABLE Party_Services (
booking_id INTEGER NOT NULL,
customer_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
service_datetime DATETIME NOT NULL,
booking_made_date DATETIME,
FOREIGN KEY (customer_id) REFERENCES Parties(party_id),
FOREIGN KEY (service_id) REFERENCES Services(service_id)
); |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 110