SQL Queries
Words: 275
Pages: 1
110
110
DownloadName of Student
Name of Instructor
Course Code
Date of Submission
SQL Queries
Question 1
SQL command and results
Command
Create table
Insert data
Copy
Paste
Return 0
Results
Command
Insert id, trip name, and distance:
Id = 42
Trip name = South Africa
Distance = 40km
Results
Command
Alter table
Drop table
Results
Updating the database creates some problems of error being incurred. The database requires a new set of data because the previous set lacks some details (Klein, 20). Thus the database has to be updated, and new information added.
Question 2
Command
Insert reservation id, trip ID, Trip date, customer number, customer last name, customer first name, phone number
Reservation id = 32
Trip id= 92
Rip date= 12/12/2018
Customer number = 32
Customer last name= Hank
Customer first name= John
Phone number= +2343111111134
Print data
Return zero
Results
Command
Retrieve reservation ID, trip ID, trip date, and customer last name;
Print data
Return 0
Results
Command
Create database
Print data
Results
Updating the database creates some problems of error being incurred. The database requires a new set of data because the previous set lacks some details. Thus the database has to be updated, and new information added (Klein, 21).
Question 3
Command
Create table
Select column = units
Select rows = total number of trips
Command
Retrieve trip and units
Create table
Command
Select Database information
Display results
Results
Updating the database creates some problems of error being incurred.
Wait! SQL Queries paper is just an example!
The database requires a new set of data because the previous set lacks some details. Thus the database has to be updated, and new information added.
Question 4
a) GRANT SELECT ON TRIP table TO TRIP ID;
b) GRANT INSERT ON new reservations TO customers, Insert;
GRANT INSERT ON new reservations TO customers, customers;
c) GRANT UPDATE (price) ON price TO trip, user;
d) GRANT SELECT (trip name, start location, distance and type) ON trip name TO DATABASE;
e) GRANT INSERT ON ADD TO DELETE;
GRANT DELETE ON DELETE TO ADD;
f) GRANT INDEX ON TRIP TO TABLE;
g) GRANT ALTER ON CUSTOMER TABLE TO TABLE, ALTER;
h) GRANT ALL ON TRIP TO GUIDE;
0GRANT ALL ON TRIP TO GUIDE;
GRANT ALL ON TRIP TO GUIDE;
Question 5
REVOKE ALL PRIVILEGES FROM user;
Question 6
a) CREATE TRIP_INDEX1 ON TRIP (TRIP_NAME);
b) CREATE INDEX TRIP_INDEX2 ON TRIP (TRIP);
c) CREATE INDEX TRIP_INDEX3 ON LAST_NAME (FIRST_NAME);
Question 7
DROP INDEX BOOK_INDEX3.
Question 8
Command
GRANT INSERT ON ADD TO DELETE;
GRANT DELETE ON DELETE TO ADD;
REVOKE ALL PRIVILEGES FROM user;
Results
b) GRANT SELECT ON TABLE NAME;
c) CREATE TRIP_INDEX1 ON TRIP (TRIP_ID);
Question 9
ALTER TABLE RESERVATION
ADD FOREIGN KEY (CUSTOMER_NUM) REFERENCES CUSTOMER (CUSTOMER_NUM);
Question 10
ALTER TABLE TYPE
ADD CHECK (VALUES OF BIKING, HIKING OR PADDLING));
Works Cited
Klein, H-J. “How to modify SQL queries to guarantee sure answers.” ACM SIGMOD Record 23.3 (1994): 14-20.
Subscribe and get the full version of the document name
Use our writing tools and essay examples to get your paper started AND finished.