Write a script to create the following tables with attributes
as specified(SQL)
Customer table with Customer’s...
Write a script to create the following tables with attributes
as specified(SQL)
Customer table with Customer’s id, name, address, city as
varchar, customer’s date of birth as date type and zip code number
where the customers id is the primary key in the table, name and
date of birth are mandatory. Id has a 10-character limit, name,
address and city have a 50-character limit, zip has a 5-character
limit
Product Table with Product id, description and finish as
varchar, price...
-- Drop the tables if they existDROP TABLE REP CASCADE
CONSTRAINTS;DROP TABLE CUSTOMER CASCADE CONSTRAINTS;DROP TABLE...
-- Drop the tables if they existDROP TABLE REP CASCADE
CONSTRAINTS;DROP TABLE CUSTOMER CASCADE CONSTRAINTS;DROP TABLE
ORDERS CASCADE CONSTRAINTS;DROP TABLE ITEM CASCADE CONSTRAINTS;DROP
TABLE ORDER_LINE CASCADE CONSTRAINTS;-- You are to change CUSTOMER
to CUSTOMERS for the Colonial database to avoid conflict with the
CUSTOMER table in Tal.-- Create the tablesCREATE TABLE REP(REP_NUM
CHAR(2) PRIMARY KEY,LAST_NAME CHAR(15),FIRST_NAME CHAR(15),STREET
CHAR(15),CITY CHAR(15),STATE CHAR(2),POSTAL_CODE CHAR(5),COMMISSION
DECIMAL(7,2),RATE DECIMAL(3,2) );CREATE TABLE CUSTOMER(CUSTOMER_NUM
CHAR(3) PRIMARY KEY,CUSTOMER_NAME CHAR(35) NOT NULL,STREET
CHAR(20),CITY CHAR(15),STATE CHAR(2),POSTAL_CODE CHAR(5),BALANCE
DECIMAL(8,2),CREDIT_LIMIT DECIMAL(8,2),REP_NUM CHAR(2) );CREATE...
Lab 5 Queries with Multiple Tables
In this lab, we do queries more than one table....
Lab 5 Queries with Multiple Tables
In this lab, we do queries more than one table. SQL provides two
different techniques for querying data from multiple tables:
• The SQL subquery
• The SQL join
As you will learn, although both work with multiple tables, they
are used for slightly different purposes.
We used WMCRM database which is what we created in Lab 4. Here
is the summary of the database schema (where schema is used in its
meaning of...
DROP TABLES IF EXISTS Artists,Genre, Members, Titles,
Tracks,SalesPeople,Studios,XrefArtistsMembers; DROP TABLES IF
EXISTS Authors,Publishers,Titles,Title_Authors,Royalties; DROP
TABLES IF...
DROP TABLES IF EXISTS Artists,Genre, Members, Titles,
Tracks,SalesPeople,Studios,XrefArtistsMembers; DROP TABLES IF
EXISTS Authors,Publishers,Titles,Title_Authors,Royalties; DROP
TABLES IF EXISTS Products,Customers,Orders,Order_details; DROP
TABLES IF EXISTS Sailors,Boats,Reserves; CREATE TABLE Authors (
au_id CHAR(3) NOT NULL, au_fname VARCHAR(15) NOT NULL, au_lname
VARCHAR(15) NOT NULL, phone VARCHAR(12) , address VARCHAR(20) ,
city VARCHAR(15) , state CHAR(2) , zip CHAR(5) , CONSTRAINT
pk_Authors PRIMARY KEY (au_id) ); CREATE TABLE Publishers ( pub_id
CHAR(3) NOT NULL, pub_name VARCHAR(20) NOT NULL, city VARCHAR(15)
NOT NULL, state CHAR(2) , country...
Garden Glory Project Questions Assume that Garden Glory designs
a database with the following tables:
OWNER...
Garden Glory Project Questions Assume that Garden Glory designs
a database with the following tables:
OWNER (OwnerID, OwnerName, OwnerEmail, OwnerType)
OWNED_PROPERTY (PropertyID, PropertyName, PropertyType, Street,
City, State, Zip, OwnerID)
GG_SERVICE (ServiceID, ServiceDescription, CostPerHour);
EMPLOYEE (EmployeeID, LastName, FirstName, CellPhone,
ExperienceLevel)
PROPERTY_SERVICE ( PropertyServiceID , PropertyID , ServiceID,
ServiceDate , EmployeeID, HoursWorked)
The referential integrity constraints are:
OwnerID in OWNED_PROPERTY must exist in OwnerID in OWNER
PropertyID in PROPERTY_SERVICE must exist in PropertyID in
OWNED_PROPERTY
ServiceID in PROPERTY_SERVICE must exist in ServiceID...
SQL DATABASE
Task 4 [1.5 marks]
Create Index (0.5 marks)
Currently, the database only contains a...
SQL DATABASE
Task 4 [1.5 marks]
Create Index (0.5 marks)
Currently, the database only contains a small number of records.
However, the data contained within it is expected to grow
significantly in the future. Creating indexes on commonly searched
columns is a way performance issues can be minimized.
Write a command to create an index on student_name column of the
student table.
Create view – 1 mark
Write a command to create a view to list the student ID and...