About

It's all about sharing random's information, activities and ect.

December 14, 2011

RDBMS CLASS

Kelas yang agak mencabar semester ni 'RDBMS' class.. Agak susah juga lah.. kena pulak dengan lect. yang kuat marah..


Ni cooding T-SQL yang agak simple

--T-SQL
declare @myname varchar (50)
begin
set @myname = 'Shahrul Amirrul Hafiz bin Shafiei'
print 'My name >> ' + @myname
end


Messages:
My name >> Shahrul Amirrul Hafiz bin Shafiei


--Looping
declare @name numeric
begin
set @name = 1
while @name < = 10
 begin
 print 'Shahrul Amirrul Hafiz Bin Shafiei'
 set @name = @name + 1
 end
end

Message :

Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei
Shahrul Amirrul Hafiz Bin Shafiei

Yang ni pulak cooding yang kitorang sangkut.. Create procedure.. Habis semua kena.. Padahal cooding dia sikit je.. hahaha


3 create a table items

Itemid
Varchar     PK
ItemName
Varchar
Description
Varchar
Quantity
Numeric



Create a stored procedure to populate the table with records
(HINT: procedure must contain 4 parameters)

4 create a stored procedure to update the quantity of an item in the items table given it’s itemid and quantity as parameter


create procedure updateQuantity (@ItemId varchar(50),@quantity numeric)
as
begin
update item set quantity=@quantity where itemid=@itemid
end

select * from item

Ad: Join the #TakNak photo contest and You might even win cash prizes and vouchers worth up to RM 2K! Stop smoking!


1 comment:

  1. uhhu , datang jenguk blog2 hottest !

    nak join segmen review blog macam cik panda kite ni tak ?

    http://orangesnowy-chan.blogspot.com/2011/12/36-segmen-hottest-fc-review-belog.html


    senang je , cuit2 sikit then tinggalkan jejak kat kotak komen okay , insyaAllah akan direview A.S.A.P =)

    suke tak suke tak ? bhahaha :D

    okayh ,
    with love ,
    Junho bias .
    brr~

    ReplyDelete