♫♥♫...:::Nhóm Học Sinh Fpt-Aptech:::...♫♥♫
Đăng Kí Thanh Viên Nào Mọi Người

Join the forum, it's quick and easy

♫♥♫...:::Nhóm Học Sinh Fpt-Aptech:::...♫♥♫
Đăng Kí Thanh Viên Nào Mọi Người
♫♥♫...:::Nhóm Học Sinh Fpt-Aptech:::...♫♥♫
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Đăng Nhập

Quên mật khẩu

Latest topics
» Tài Liệu java và Dream8
Ai cần Bài LAB 4 liên hệ I_icon_minitimeMon Dec 02, 2013 6:22 pm by hoangthai0302

» [Tham khảo] Đề thi BDW FPT
Ai cần Bài LAB 4 liên hệ I_icon_minitimeWed Aug 14, 2013 8:08 pm by yowisu

» Nhận giúp làm đồ án, project cuối kỳ, bài tập lớn cho sinh viên học lập trình dotNet tại Hà Nội
Ai cần Bài LAB 4 liên hệ I_icon_minitimeMon Jul 08, 2013 11:44 am by aiglevnpro

» Đây là tài liệu học RDBMS mời download
Ai cần Bài LAB 4 liên hệ I_icon_minitimeFri Nov 09, 2012 9:51 am by laiconghung

» [Tham Khảo] Ass 4 của tui :)
Ai cần Bài LAB 4 liên hệ I_icon_minitimeFri Oct 26, 2012 10:21 pm by dat21892

» Giới thiệu Đại học FPT-Greenwich
Ai cần Bài LAB 4 liên hệ I_icon_minitimeThu Oct 11, 2012 2:02 pm by comnhom.it

» De Ly Thuyet 134 cau day. Chuan luon do cua aptech nha
Ai cần Bài LAB 4 liên hệ I_icon_minitimeTue Jun 26, 2012 10:33 pm by PhucBach

» THÔNG BÁO CƠ HỘI NGHỀ NGHIỆP
Ai cần Bài LAB 4 liên hệ I_icon_minitimeTue Jun 05, 2012 10:48 am by yenns

» Khóa học miễn phí thiết kế diễn đàn bằng Vbulletin tại ICODE
Ai cần Bài LAB 4 liên hệ I_icon_minitimeTue May 01, 2012 12:15 pm by mr_icode


Ai cần Bài LAB 4 liên hệ

2 posters

Go down

Ai cần Bài LAB 4 liên hệ Empty Ai cần Bài LAB 4 liên hệ

Bài gửi by Bonstar Thu Nov 25, 2010 4:30 pm

ai cần liên hệ nick yahoo duong.aptech92@yahoo.com, tối 10 giờ mới online.
Bonstar
Bonstar
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 80
Join date : 15/09/2010
Age : 32
Đến từ : Tp.HCM

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by Bonstar Thu Nov 25, 2010 6:57 pm

Đây là bài World Class Travel
--Tao db World Class Travel and Tours
create database WCTT
go
use WCTT
go
--Tao table ten Flights
create table [Flights]
(
AircraftCode nvarchar(10) primary key,
Ftype nvarchar(10),
[Source] nvarchar(20),
Destination nvarchar(20),
DepTime datetime,
JourneyHrs int
)
GO
--Chen du lieu vao table Flights
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('UA01','Boeing','Los Angeles','London','15:30',6)
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('UA02','Boeing','California','New York','9:30',Cool
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('SA01','Boeing','Istanbul','Ankara','10:45',Cool
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('SA02','Airbus','London','Moscow','11:15',9)
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('SQ01','Airbus','Sydney','Ankara','01:45',15)
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('SQ02','Boeing','Perth','Aden','13:30',10)
Insert into Flights(AircraftCode,FType,[Source],Destination,Deptime,JourneyHrs)
values('SQ03','Airbus','San Francisco','Nairobi','15:45',15)
--Hien thi thong tin trong bang Flights
select *from Flights
go
--Hien thi thong tin AirCraftCode, Source, Destination, Deptime
Select AirCraftCode, [Source], Destination, Deptime from Flights
--Them thong tin vao table giong table ban dau
insert into Flights (AircraftCode,Ftype,[Source],Destination,DepTime,JourneyHrs)
values('UA03','Boeing','Los Angeles','London','15:30',6)
go

--Hien thi top 65%
Select top (65) percent* from Flights
go
--Hien thi 2 record dau tien
Select top (2) * from Flights
go
--Tong so chuyen bay
Select COUNT (AirCraftCode) as TongChuyenBay
from Flights
--So tien chi tra
Select *, JourneyHrs*150 as Tientra
From Flights
Bonstar
Bonstar
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 80
Join date : 15/09/2010
Age : 32
Đến từ : Tp.HCM

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by Bonstar Thu Nov 25, 2010 6:59 pm

Đây là bài Passenger
/*LAB4 trang 151*/
create database PASS
go
Use PASS
go
/*Create Passenger table*/
Create table passengers
(
PNRNo int not null,
TicketNo int not null,
PassName nvarchar (25) not null,
Age int not null,
Sex char (6)not null,
)
go
/*Insert the following details in the Passenger table*/
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (1,1,'Allan Smith',45,'Male')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (1,2,'Stella Smith',23,'Female')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (1,3,'Pamella Smith',26,'Female')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (2,4,'Peter Jones',27,'Male')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (2,5,'Stefa Jones',30,'Female')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (3,6,'Alex Lee',22,'Male')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (3,7,'Greta Lee',20,'Female')
insert into passengers(PNRNo,TicketNo,PassName,Age,Sex)
values (3,8,'Steve Wilson',28,'Male')
go
/*Display PassName,Age and Sex*/
select PassName,Age,Sex from passengers
go
/*Insert record whose details match those of 'Stefa Jones'*/
insert into passengers
values (2,5,'Britney Spear',30,'Female')
go
/*Display only those records such that duplicate records do not appear*/
select distinct * from passengers
go
/*Display the total number of passenger*/
select COUNT (TicketNo)as TotalNumber from passengers
go
/*Display the average age of the passenger from the Passenger table*/
select AVG(Age) as AverageAge from passengers
go
/*Display the Top 3 records by declaring an integer variable and using it with the Top clause*/
select top 3 (TicketNo)from passengers
go
declare @abc int
set @abc=3
select top (@abc) * from passengers
go
/* Create a table NewPassenger with the same structure as the Passenger table*/
create table NewPassenger
(

PNRNo int not null,
TicketNo int not null,
PassName nvarchar (25) not null,
Age int not null,
Sex char (6)not null,
)
go
insert into NewPassenger(PNRNo,TicketNo,PassName,Age,Sex)
values (1,1,'Allan Smith',45,'Male')
insert into NewPassenger(PNRNo,TicketNo,PassName,Age,Sex)
values (1,2,'Stella Smith',23,'Female')
insert into NewPassenger(PNRNo,TicketNo,PassName,Age,Sex)
values (1,3,'Pamella Smith',26,'Female')
go
Bonstar
Bonstar
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 80
Join date : 15/09/2010
Age : 32
Đến từ : Tp.HCM

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by Bonstar Thu Nov 25, 2010 7:00 pm

Đây là bài Reservation
--Lab4 trang 152 RDBMS

create database NewPass
go
use NewPass
go
--create a Reservation table containing the following structure
Create table [Reservation]
(
PNRNo int not null,
AircraftCode nvarchar(10) not null,
JourneyDt datetime not null,
NoOfSeats int not null,
[Address] nvarchar(50) not null,
ContactNo bigint not null,
[Status] char (02)
)
go
--Insert Data
Insert into Reservation(PNRNo ,AircraftCode ,JourneyDt ,NoOfSeats ,[Address] ,ContactNo ,[Status] )
Values(1,'IA01','11-Nov-2006',2,'Newyork',9154896322,'C'),
(2,'9W01','15-Nov-2006',3,'London',9155659891,'C'),
(3,'IA01','11-Dec-2006',4,'Sydney',9147812569,'C'),
(4,'9W02','21-Dec-2006',2,'London',9165894752,'R'),
(5,'BA01','22-Dec-2006',1,'Perth',9135627489,'C')
go
--Display AircraftCode And JourneyDt
Select AircraftCode, JourneyDt from Reservation
go
--Display the total number of seats from the Reservation
Select SUM (NoOfSeats) as totalseats from Reservation
go
--Create a table named NewReservation having the same structure as the Reservation table
Create table [NewReservation]
(
PNRNo int,
AircraftCode nvarchar(10),
JourneyDt datetime,
NoOfSeats int,
[Address] nvarchar(50),
ContactNo bigint,
[Status] char (02)
)
go
--Use the INSERT WITH clause to insert values from the Reservation table into the NewReseervation table

Insert into NewReservation(PNRNo ,AircraftCode ,JourneyDt ,NoOfSeats ,[Address] ,ContactNo ,[Status] )
Values(1,'IA01','11-Nov-2006',2,'Newyork',9154896322,'C'),
(2,'9W01','15-Nov-2006',3,'London',9155659891,'C'),
(3,'IA01','11-Dec-2006',4,'Sydney',9147812569,'C'),
(4,'9W02','21-Dec-2006',2,'London',9165894752,'R'),
(5,'BA01','22-Dec-2006',1,'Perth',9135627489,'C');
with Reservation(PNRNo ,AircraftCode ,JourneyDt ,NoOfSeats ,[Address] ,ContactNo ,[Status] )
as
(
select *from NewReservation
)
insert into Reservation
select * from Reservation
go
--Modify the Reservation table and add a column'PassName' ...
alter table Reservation
add PassName varchar (25)
go
--Modify the Reservation table and make PNRNo as the Primary Key
alter table Reservation
add primary key (PNRNo)
go

Bonstar
Bonstar
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 80
Join date : 15/09/2010
Age : 32
Đến từ : Tp.HCM

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by Bonstar Thu Nov 25, 2010 7:39 pm

không bấm thank là ăn dép
Bonstar
Bonstar
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 80
Join date : 15/09/2010
Age : 32
Đến từ : Tp.HCM

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by ananh Thu Nov 25, 2010 8:01 pm

có thấy nút thank ở chổ nào đâu mà bấm Basketball (30 char cheers )
ananh
ananh
Khỉ Trưởng Lão
Khỉ Trưởng Lão

Tổng số bài gửi : 34
Join date : 23/09/2010
Đến từ : Nhà người ta..

Về Đầu Trang Go down

Ai cần Bài LAB 4 liên hệ Empty Re: Ai cần Bài LAB 4 liên hệ

Bài gửi by Sponsored content


Sponsored content


Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết