Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Answer E and F. For a simple BBS (Bulletin Board System) we use the following SQL statements to cre ate two tables: one storing

image text in transcribed

Please Answer E and F.

For a simple BBS (Bulletin Board System) we use the following SQL statements to cre ate two tables: one storing all posted messages and the other users who can post them. CREATE TABLE MESSAGE mesgid INTEGER, poster INTEGER, subject CHARCS0) body CHARC255), postdate DATETIME, PRIMARY KEY mesgid, FOREIGN KEY poster REFERENCES USER (userid) ON DELETE CASCADE ON UPDATE CASCADE CREATE TABLE USER userid CHARC50), password CHARC5), email CHAR(50), status CHARC1) PRIMARY KEY (userid) (a) There is an error in one of the above statements. Point out the error, explain why it is wrong and correct the error by re writing that SQL statement (b) Suppose there is a user with userid John in the database who has posted 100 messages. What will the DBMS do if we delete John from table USER? What if we change John's userid to Michael? (c) Write an SQL statement to create a view of those messages with all their attributes that (d) Write an SQL statement to create a domain such that the status attribute can only take (e) Suppose occasionally the system will post some announcement messages, but unfortu- are posted by John' two values, i.e., j and 's. nately the system is not a user (thus it does not appear in the USER table). How can you allow these messages being posted while not adding a system user and not violating the foreign key constraint? (t) One desirable advanced feature of the BBS system is that each user can post messages not only to the public, but also to a subset of other users that are explicitly specified by userid when the message is posted. How would you change the definitions of the above two tables so that this new feature can be implemented? (You may introduce other tables if necessary.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

What factors affect a person's ability to qualify for a mortgage?

Answered: 1 week ago