Write the sql code, Database Management System

Assignment Help:

Express the following queries in SQL:

(a) Write the SQL code that will create ALL the four tables given in the appendix. Your answer should not contain the primary key and foreign key constraint declaration. The data type for each attribute should be for the SQL Server 2005 convention.

(b) Having created the table structure in question (a) above, write SQL code to make the following change in the structure of the tables:

(i) Make the PubId the Primary Key in the Publisher table

(ii) Make the ISBN the primary key and the Pub_Id the foreign key in the Book table.

(iii) Make the AU_ID and the ISBN the Primary Key of the Book_Author table.

(iv) Make the AU_ID and the ISBN the foreign key of the Book_Author table.

(v) Make the AU_ID the Primary key of the Author table

(c) After creating the table structure above, you write the following SQL code to insert the first row in the Book table:

Insert into Book

Values(‘0-0038307-6-4', ‘dBASE III : A Practical Guide', 1985, 469);

When you run the above code SQL Server shows an error message. Explain the reason for the error. How will you correct the error? Explain your answer fully.

(d) If you wanted the au_id column to be automatically incremented when inserting new record in the author table, how would you modify the create statement in question(a) above so that it starts with the number 100 and increment by one every time you create a new record in that table.

(e) Write the SQL code to change the year born value from 1970 to 1971 for the author whose ID is 1.

(f) Write the SQL code required to list all book details whose title's name contains the word "Information".


Related Discussions:- Write the sql code

Convert encrypted hsql database into csv format, Project Description: We...

Project Description: We have an encrypted HSQL Database which we want to change into csv format. HSQL DB . We have java application (jar file) which reads that database but n

Oracle, how oracle can be used

how oracle can be used

Guidelines for creation of table, Guidelines for creation of table: ...

Guidelines for creation of table: Table name should begin with an alphabet. In table name, single quotes and blank spaces are not allowed. Reserve words of that DBM

Mention the purpose of sid and sod lines, Mention the purpose of SID and SO...

Mention the purpose of SID and SOD lines SID (Serial input data line): It is an input line by which the microprocessor accepts serial data. SOD (Serial output data line)

Exclusive lock, Exclusive lock It is asked for by a transaction on...

Exclusive lock It is asked for by a transaction on a data item that it wants to update. No other transaction can put either a shared lock or an exclusive lock on a dat

What are advantages of using an index and disadvantages, What are the advan...

What are the advantages of by using an index and what are its disadvantages ? In difference, if the search key of a secondary index is not a candidate key, it is not sufficient

Case-based online phone repair, please i request for your assistance in de...

please i request for your assistance in developing a case-based online phone repair

Improve efficiency of database, Smart Alex Catering Sevice (SACS) is a comp...

Smart Alex Catering Sevice (SACS) is a company offering top class catering staff  for prestigious events.  The company employs approximately 200 hourly paid contact staff - chefs,

Find the employee name, Example -Find the employee name, salary, department...

Example -Find the employee name, salary, department number and average salary of his/her department, for those employees whose salary is more than the average salary of that depart

Explain the steps for reduction of e-r model, Explain the steps for reducti...

Explain the steps for reduction of E-R model into relational model. Ans:(a) Entity set in E-R model will be considered as table name in relational Model. (b) Attributes of e

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd