Question

In: Computer Science

Part 2: You will create five tables in your ColonialAdventureTours database. Please do not write your...

Part 2: You will create five tables in your ColonialAdventureTours database. Please do not write your own SQL Commands for this task, use data found in the following Colonial_create.txt file and copy and paste the commands into MySQL workbench. Then add Primary key, Foreign key, and not null constraints appropriately. Then run your codes. Note: Remember that since you enforced referential integrity (foreign key constraints) that you must create the "primary" tables before you can create the "related" tables in the relationship. [Create tables in right orders].

Solutions

Expert Solution

   CREATE TABLE Packages (Package_Id int PRIMARY KEY,Package_Number int);


   CREATE TABLE Package_Dimensions (Dimension_Id int Primary Key, Package_Id int REFERENCES Packages (Package_Id),Height int,Width int,Weight int,Length int);


   CREATE TABLE Status_Codes ( Status_Code int Primary Key,Description varchar(100));


   CREATE TABLE Exception_Codes (Exception_Code int Primary Key,Description varchar(100));


   CREATE TABLE Package_Statuses (Package_Status_Id int Primary Key, Status_Id int REFERENCES Status_Codes (Status_Code), Package_Id int REFERENCES Packages (Package_Id),Status_Code int, Status_Date date, Exception_Code int REFERENCES Exception_Codes (Exception_Code));


   CREATE TABLE Limit_Codes (Limit_Code int Primary Key,Description varchar(100));


   CREATE TABLE Allowable_Limits (Limit_Id int Primary Key, Limit_Code int REFERENCES Limit_Codes (Limit_Code), Date_Active date, Date_Inactive date, Limit_Value int);

Inserting Data

INSERT INTO Packages values (103,1011);
INSERT INTO Packages values (104,1010);
INSERT INTO Packages values (105,1010);
INSERT INTO Packages values (106,1010);
INSERT INTO Packages values (107,1012);
Select * from Packages;

INSERT INTO Package_Dimensions VALUES (6,103,10,20,800,40);
INSERT INTO Package_Dimensions VALUES (4,104,10,20,800,40);
INSERT INTO Package_Dimensions VALUES (2,105,10,20,800,40);
INSERT INTO Package_Dimensions VALUES (1,106,10,20,800,40);
INSERT INTO Package_Dimensions VALUES (3,107,10,20,800,40);
Select * from Package_Dimensions;

INSERT INTO Status_Codes VALUES (1,'The package Status is Passive');
INSERT INTO Status_Codes VALUES (2,'The package Status is Hold Back');
INSERT INTO Status_Codes VALUES (3,'The package Status is Not Done');
INSERT INTO Status_Codes VALUES (5,'The package Status is Done');
INSERT INTO Status_Codes VALUES (6,'The package Status is Delay');
Select * from Status_Codes;

INSERT INTO Exception_Codes VALUES (1,'The package Has Seat Errors');
INSERT INTO Exception_Codes VALUES (2,'The package Has Condition Errors');
INSERT INTO Exception_Codes VALUES (3,'The package Has Connection Errors');
INSERT INTO Exception_Codes VALUES (4,'The package Has abc Errors');
INSERT INTO Exception_Codes VALUES (5,'The package Has def Errors');
Select * from Exception_Codes;

INSERT INTO Limit_Codes VALUES (1,'This Limit Code has abc Features');
INSERT INTO Limit_Codes VALUES (2,'This Limit Code has def Features');
INSERT INTO Limit_Codes VALUES (3,'This Limit Code has ghi Features');
INSERT INTO Limit_Codes VALUES (4,'This Limit Code has jkl Features');
INSERT INTO Limit_Codes VALUES (5,'This Limit Code has mno Features');
Select * from Limit_Codes;

INSERT INTO Package_Statuses VALUES (1,101,100,4,'2019/09/04',3);
INSERT INTO Package_Statuses VALUES (4,104,100,3,'2019/01/04',6);
INSERT INTO Package_Statuses VALUES (6,107,100,6,'2019/09/04',2);
Select * from Package_Statuses;

;

INSERT INTO Allowable_Limits VALUES (2,1,'2019/09/04','2019/09/08',10);
INSERT INTO Allowable_Limits VALUES (3,2,'2019/07/03','2019/07/12',8);
INSERT INTO Allowable_Limits VALUES (4,3,'2019/01/02','2019/01/09',7);
INSERT INTO Allowable_Limits VALUES (5,4,'2019/09/08','2019/09/09',4);
INSERT INTO Allowable_Limits VALUES (6,5,'2019/09/09','2019/09/11',3);
Select * from Allowable_Limits;

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........


Related Solutions

Write create table statements to create tables for the Exoproduct employees computers database depicted by the...
Write create table statements to create tables for the Exoproduct employees computers database depicted by the relational schema created in a mini case MC5 in chapter 3. Use insert into statements to insert no fewer than 2 and no more than 10 records per table.
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based on your entities defining The attributes within each table The primary and foreign keys within each table *****Show your database tables, tables attributes, primary and foreign keys***** Do not forget to check the lesson slides and videos that show you how to convert an ER/EER into a database schema, and how to create a database and tables using MS SQL Server.
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in...
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in Oracle’s SQL*Plus.The information you need about the database ARE IN THE CHARTS BELOW. Each worksheet includes the following information about its associated table: ➢ Column names (for example, the jr_order table contains the orderID, customerID, orderDate, orderStatus, and orderShippedDate columns); ➢ Column data types (for example, orderID is INT, orderStatus is VARCHAR2(2), etc.); ➢ Column constraints, if any (for example, orderID in the jr_order...
Create tables according to the mapping. Add 2 records to each. Create 5 queries for database...
Create tables according to the mapping. Add 2 records to each. Create 5 queries for database of 3 table joins to use most of the tables or group of tables in database. You should not have tables that are of no use. Student(ssn, name, major) Class(classID, name, f_ssn) Faculty(ssn, name, office_num, dept_id) Department(Dept_id, office_num, f_ssn) Enroll(s_ssn, classID, grade) Professor(f_ssn, alma-mater, tenured) Instructor(f_ssn, term_degree, type) Lecture(classID, method) Lab(classID, location) Person(ssn, dob, gender)
Please create the following tables for a tool rental database with appropriate primary keys & foreign...
Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. Assumptions: 1. Each tool belongs to a category. 2. Each category may have a parent category but the parent category should not have a parent category (so at most two levels). E.g., a Tool A belongs to the electric mower, and electric mowers belong to mowers. Mower has no parent category. 3. Each tool can be rented at different time units. The typical...
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient,...
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient, fullName, biologicalMother, birthdate, address) doctor(idDr, fullName, specialization, consulRates) inpatient(idPatient, entryTime, outTime, idDr, idRoom). Please make entryTime as column that is going to be filled automatically when care record is being add room(idRoom, roomName, cost) fill the data above to each table Create sql query and relational algebra expressions for the query Please give me detailed answer so I could learn from it. Thank you...
Flag Create a database for PAINTER and PAINTING entities/tables; Decide on your own what will be...
Flag Create a database for PAINTER and PAINTING entities/tables; Decide on your own what will be the attributes of PAINTER and PAINTING tables; Insert at least 5 records on each table Deliverables: Screenshot of PAINTER and PAINTING table structures using the describe command Screenshot of PAINTER and PAINTING table records/entries using select command.
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The first database table will contain the names of at least four movies. The second table will be a list of actors who appear in the movies. The third table will be an associative table that describes the relationship between the actors and their movies (which actors appear in which movies). Actors and movies have a “many-to-many relationship,” meaning an actor can be in multiple...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The...
Create three MySQL database tables and write SQL scripts to read, insert, and delete data. The first database table will contain the names of at least four movies. The second table will be a list of actors who appear in the movies. The third table will be an associative table that describes the relationship between the actors and their movies (which actors appear in which movies). Actors and movies have a “many-to-many relationship,” meaning an actor can be in multiple...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. [30 points] Assumptions: Each tool belongs to a category. Each category may have a parent category but the parent category should not have parent category (so at most two levels). E.g., a Tool A belongs to electric mower, and electric mower belongs to mower. Mower has no parent category. Each tool can be rented at different time units. The typical time...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT