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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Taking a required SQL class, need some help

Author  Topic 

hans_sprungfeld
Starting Member

2 Posts

Posted - 2013-04-29 : 09:54:53
I have an assignment and I need some help. I can provide the database if you'd like.

The tasks I need to perform are the following:
1.
Use the following information to create a new table named LARGE_SLIP.
I am provided info for Column, Type, length, DecimalPlaces, Nulls Allowed?, & Description. I am ok with creating column, type, length, and decimal. Not sure how to do Nulls Allowed? & Description.

2.
Insert into the :LARGE_SLIP table the marina number, slip number, rental fee, boat name, and owner number for those slips whose length is 40 feet.


3.
Alexamara has increased the rental fee of each large slip by $100. Update the rental fees in. the
LARGE_SLIP table accordingly.


4.
After increasing the rental fee of each large slip by $100 (Exen:ise 3),Alexamara has now decided to decrease the rental fee of any slip whose fee is more than $4,000 by 1%. Update the rental fees in the LARGE_SLIP table accordingly.


5.
Insert a new slip into 'the LARGE_SLIP table. The marina number is 1, the slip number is
A4, the rental fee.is $3,900.00, the boat name is Bilsan, and the owner number is DE62.

6.[b]
Delete all slips in the LARGE_SLIP table in which the owner number is TR72.



I realize this is a lot to ask, but I sure could use the help. SQL is not in my wheelhouse and I gotta plow through this thing. THANK YOU very much for any help you can provide.

hans_sprungfeld
Starting Member

2 Posts

Posted - 2013-04-29 : 11:07:11
Here is what I have so far:

1.
-------------------------------------------
CREATE TABLE LARGE_SLIP
(MARINA_NUM char (4) not null,
SLIP_NUM char (4) not null,
RENTAL_FEE int,
BOAT_NAME char (50),
OWNER_NUM char (4),);

-------------------------------------------

2.
-------------------------------------------
insert into LARGE_SLIP (column1,column2,column3,column4,column5)
values ('1', 'A1', '$3800', 'Anderson II', 'AN75');
values ('1', 'A2', '$3800', 'Our Toy', 'EL25');
values ('1', 'A3', '$3600', 'Escape', 'KE22');
values ('2', '5', '$4200', 'Dolphin 40', 'N027');
values ('2', '6', '$4200', 'Ray 4025', 'TR72');


3.
--------------------------------------------
Update LARGE_SLIP
Set Rental_Fee = ' *100'
where Marina_Num = '1'
where Marina_num = '2' ;


4.
--------------------------------------------
Update LARGE_SLIP
set Rental_Fee = ' -40'
where Rental_Fee = '4200' ;

5.
--------------------------------------------
insert into LARGE_SLIP
values ('1', 'A4', '$3900', 'Bilsan', 'DE62') ;

6.
--------------------------------------------
Delete
From LARGE_SLIP
where Owner_Num = 'TR72" ;
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-30 : 04:09:52
1. For NULLs allowed either leave as is (as default is NULLable) or just specify NULL similar to NOT NULL against column names
For descriptions the method is to add an extended property
see

http://msdn.microsoft.com/en-us/library/ms180047.aspx

2. Not enough information as I cant see any column in table which stores length of slip

3. it says increased by 100. so it should be

Update LARGE_SLIP
Set Rental_Fee = Rental_Fee + 100
where Marina_Num = '1'
where Marina_num = '2'


4.similar to 3 above use as per logic specified
the current query given is wrong

5. correct
6.correct

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -