Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
zspeed01
Starting Member
6 Posts |
Posted - 2013-04-29 : 20:02:34
|
Hi, can someone help me solve these problems. Thank you in advance#1 Create a database named PRACTICE that you will then use for all remaining problems.#2 Create the tables and appropriate constraints based on the following ER diagram. Use appropriate data types. Note that the size column should only accept S, M, or L. In addition the price column should have values greater than zero. All columns in both tables are required.Catgeory ProductC #3 Insert 3 rows in the Category table. The db is for a small shoe store, so use appropriate data for the description (“Children” “Men”, “Women”,)#4 Insert 3 Product records for each category in the product table. Use whatever data you see as appropriate.#5 Use one statement to increase the price of all products in the Children category by 35%. #6 Use one statement to delete all products for the Children category.#7 Create and execute a view named PRACTICE_VIEW that shows all columns from both tables. Use an inner join.#8 Create a database trigger named PRACTICE_TRIGGER that prevents a user from deleting a Product record on Tuesdays. Display an appropriate error message. Make sure to show that the trigger is working properly. #9 Create a stored procedure named SP_ PRACTICE that will be used to insert records into the Product table. Make sure to show that the procedure is working properly.This is what I have so far:CREATE DATABASE PRACTICEUSE PRACTICE--2-CREATE TABLE Catgeory (cID int NOT NULL IDENTITY PRIMARY KEY,ItemDescription varchar(50) NOT NULL) CREATE TABLE Product(pID int NOT NULL IDENTITY PRIMARY KEY,ItemDescription varchar(25) NOT NULL,cID int REFERENCES Catgeory(cID) NOT NULL,Price MONEY NOT NULL,Size varchar(25) NOT NULL)drop table product--3--ALTER TABLE CatgeoryADD Men varchar(15) NOT NULL, Women varchar(15) NOT NULL, Children varchar(15) NOT NULL --4-- INSERT Product VALUES ( 10,'DRESS', 10, 15, 'L'), (11, 'SHOES', 11, 45, 'M'), (12,'JACKET', 12, 75, 'M') |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-04-29 : 20:29:15
|
For #3, you want to use an INSERT statement (DML) not an ALTER TABLE (DDL). |
|
|
zspeed01
Starting Member
6 Posts |
Posted - 2013-04-29 : 23:05:34
|
I corrected it...Thanks for your help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-30 : 04:38:30
|
#5 requires UPDATE,#6 delete ,#7 CREATE VIEW and join#8 CREATE TRIGGER and RAISERROR#9 CREATE PROC and EXEC------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|