Question
SQL QUERIES
1) Using the Product and PC relations, create both tables in your database and insert all the data. Show the SQL statements to create each table and show a representative SQL insert statement for the data in each table (i.e. you do not need to show insert statements for all the data).
– For the remaining questions, assume that your SQL is part of a program function and the function provides the input needed for your SQL query.
2) Create a SQL read-only transaction to display the maker, model, and price for all PCs of a given maker with a minimum quantity of RAM. Show the SQL statement and result with the following input values - maker:D, ram:512.
3) Create a SQL transaction to delete all tuples with a given maker and model from both the PC and Product relations. Use an isolation level that allows dirty reads. Show the SQL statement and result with the following input values - model:A, model:1003.
4) Create a SQL statement to update the price of every model by 3% for a given maker. Use an isolation level that disallows reading modified, uncommitted data. Show the SQL statement and result with the following input values - model:E.
5) Create a SQL transaction to insert a new tuple in the Product and PC tables. Use the default isolation level. Show the SQL statement and result with the following input values - maker:X, model:9001, type:PC, speed:3.02, ram:1024, hd:300, price:1011.

maker type A A A A pc pc pc laptop laptop laptop PC PC pc laptop PC B B B C D D D D D model 1001 1002 1003 2004 2006 2006 100
(a) Sample data for relation PC 1013 90€ 082 1024 696 OLL 099 08 091 091 00€ 097 TOT 092 007 ÞEOT OTS 6POT 089 619 BLT 966
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: I would be able to answer only the first question as per the Chegg guidelines. Thank you for your understanding.

1.

The SQL query to create the Product table would be:

CREATE TABLE Product
(
maker varchar(1),
model int,
type varchar(15)
);

Representative SQL Query to insert data into Product table is given below:

INSERT INTO Product VALUES('A',1001,'pc');

Output:

maker model type A 1001 pc

The SQL query to create the PC table would be:

CREATE TABLE PC
(
model int,
speed DOUBLE(3,2),
ram int,
hd int,
price int
);

Representative SQL Query to insert data into PC table is given below:

INSERT INTO PC VALUES (1001,2.66,1024,250,2114);   

Output for INSERT INTO PC:

model speed ram hd price 1001 2.66 1024 250 2114

Solution ends.

Please comment and let me know if you have any further doubts. Please upvote this answer if you like it.

Thank you.

Have a good day.

Add a comment
Know the answer?
Add Answer to:
SQL QUERIES 1) Using the Product and PC relations, create both tables in your database and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help we are suppose to explain what the C code does. This is the electronics database (6 pts) This problem is...

    Please help we are suppose to explain what the C code does. This is the electronics database (6 pts) This problem is based on Electronics database. Add some annotations to the following table to explain what the C program is doing in detail. Note that "void" is how C declares a function that does not return anything. You are expected to generalize or research svntaxes not mentioned in the lecture C Program Annotation void newPCproduct EXEC SQL BEGIN DECLARE SECTION;...

  • Find the manufacturer(s) of the computer (PC or laptop) with the highest available speed. Write in...

    Find the manufacturer(s) of the computer (PC or laptop) with the highest available speed. Write in Relational Algebra. Pc 1002 pc pc Product model maker type 1001 pc 1003 pc 2004 laptop 2005 laptop 2006 laptop 1004 pc 1005 pc 1006 2007 laptop 1007 1008 pc 1009 pc 1010 pc 3004 printer 3005 printer 1011 pc 1012 1013 pc 2001 laptop 2002 laptop 2003 laptop 3001 printer 3002 printer 3003 printer 2008 laptop 2009 laptop 2010 laptop 3006 printer 3007...

  • Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB...

    Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and...

    Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and phones of all swimmers currently in level (of id) 3. +-------+---------+---------------------------+ | FName | LName   | EMail                     | +-------+---------+---------------------------+ | Bobby | Khan    | theBKhan1 | | Clara | Johnson | ClaraJohnson_11 | +-------+---------+---------------------------+ 2 rows in set (0.00 sec) (2) Provide the names of swimmers who have signed up to participate in the event '100M Butterfly' of Meet id 1. +-------+---------+ | FName...

  • Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In...

    Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In this project, we combine the concepts of Recursion and Merge Sorting. Please note that the focus of this project is on Merging and don't forget the following constraint: Programming Steps: 1) Create a class called Art that implements Comparable interface. 2) Read part of the file and use Merge Sort to sort the array of Art and then write them to a file. 3)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT