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

Define multivalued dependency, Define multivalued dependency.  What do unde...

Define multivalued dependency.  What do understand by trivial multivalued dependency?  Ans: A multivalued dependency is a full constraint among two sets of attributes in a rela

Self-join, Self-Join:   In a self join a table is joined with itself.  Let ...

Self-Join:   In a self join a table is joined with itself.  Let consider the following sample partial data of EMP table EMPNO ENAME MGRID

Define the basic operations of the relational algebra, Define the basic ope...

Define the basic operations of the relational algebra?     Ans: Basic operators of relational algebra are: 1. Union (∪) - Selects tuples which are in either P or Q or in bot

Function module, When a function module is activated syntax checking is per...

When a function module is activated syntax checking is performed automatically. YEs, a function module is activated syntax checking.

Database security, Ask questiwhat is row indicator in database on #Minimum...

Ask questiwhat is row indicator in database on #Minimum 100 words accepted#

Define average seek time, Define average seek time. The average seek ti...

Define average seek time. The average seek time is the average of the seek times, calculated over a sequence of random requests.

Design of a database, Ask questioYou are the database administrator in a un...

Ask questioYou are the database administrator in a university. You have been tasked to come up with a new database for the University. Using the stages in Database Life Cycle come

Define forms based interfaces, Define Forms Based Interfaces? Forms-Bas...

Define Forms Based Interfaces? Forms-Based Interfaces - A forms-based interface display a form to each user. Forms are commonly designed and programmed for naive users and inte

Define access time, Define access time. Access time is the time from wh...

Define access time. Access time is the time from when a read or write request is issued to when data transfer starts.

Describe the algorithm to draw the dependency graph, Describe the algorithm...

Describe the algorithm to draw the dependency graph?   Ans: Algorithm to draw Precedence Graph is like this: a.  For every transaction T i participating in schedule S, make

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