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

Database Management System, Assume that you are responsible for selecting a...

Assume that you are responsible for selecting a new DBMS product for Sohar Hospital

Improve efficiency in query evaluation, Question: AirwaysCentre, an int...

Question: AirwaysCentre, an international airline booking company currently uses a relational database system for their operations, which includes the following relations: P

Define page, Define page. The database is partitioned into some number ...

Define page. The database is partitioned into some number of fixed-length blocks, which are referred to as pages.

Create table and insert data manufacturer-dbms, Create a table according to...

Create a table according to given data:  AmbulanceDriver(Driver_Number#, Name, Address, Birth_Date) AmbulanceDriverTeam(Team_Number#, Driver_Number#, Join_Date, Lea

Checkpoint, what is check point in database management system

what is check point in database management system

Explain network model in dbms, Explain Network Model in DBMS? Network ...

Explain Network Model in DBMS? Network Model - It was formalised within the late year of 1960s through the Database Task Group of the Conference on Data System Language (DBTG

Consistency error-database errors, Consistency error : These errors happen ...

Consistency error : These errors happen due to the inconsistent state of database caused may be due to wrong implementation of commands or in case of a transaction abort.  To overc

We need help in booking system for golf business, We need help in Booking S...

We need help in Booking System for Golf Business Development of a web based booking system which permits clients to book golf lessons with the following features- a) 4 user p

What is data mining?, Question 1 Define OLTP? Explain the Differences betw...

Question 1 Define OLTP? Explain the Differences between OLTP and Data Warehouse Question 2 What is Architecture? Explain various components involved in it Question

Create a customer database and apply queries, For the question given below,...

For the question given below, you are required to submit design and implementation documentation as described over the page. Design, implement (in Java), test and document a set of

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