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 |
ghjkla
Starting Member
1 Post |
Posted - 2013-05-20 : 09:39:13
|
Create 3 tables and insert data as followsStudents (Student list)StudentID (int) Name (VarChar(50)) Age (Tinyint) stGender (bit)1 Joe Hart 25 12 Colin Doyle 20 13 Paul Robinson 16 Null4 Luis Garcia Paulson 17 05 Ben Foster 30 1Projects (Project list)PID(int) PName (Varchar (50)) Cost(float) Type (varchar (10))1 NewYork Bridge 100 Null2 Tenda Road 60 Null3 Google Road 200 Null4 The Star Bridge 50 NullStudentProject(Describe Student Work in Project) Example: The first row of following table denote ‘Joe Hart work in The Star Bridge project on 15/05/09 for 3 month’StudentID (int) PID (int) WorkDate (datetime) Duration (int)1 4 15/05/09 32 2 14/05/09 52 3 20/05/09 62 1 16/05/09 43 1 16/05/09 63 4 19/05/09 74 4 21/05/09 8Constrainta. Apply the Check Constraint to the Age column of Students table so that the Age is greater than 15 and less than 33.b. Apply the Primary Key Constraint for the StudentID for Students table, PID for Projects, (StudentID, PID) for StudentProject tablec. Apply the Default Constraint to the Duration column of StudentProject so that the Duration is 0 if not inputd. Apply the Foreign Key Constraint on StudentProject for StudentID column rference Students (StudentID), for PID column references Project (PID)2. Update the Type for all prodect of the Projects table in case: - Type= ‘Education’ if Cost <80 - Type=’Normal’ if Cost between 80 and 150 - Type=’Government’ if Cost >150After updated PID Pname Cost Type1 1 NewYork Bridge 100 Normal2 2 Tenda Road 60 Education3 3 Google Road 200 Govemment4 4 The Star Bridge 50 Education3. Display a list of students worked more than one project Student Name Number Of Project Works1 Colin Doyle 32 Paul Robinson 24. Display a list of students with a total time (Sum of the Duration) working in projects is the largest Student Name Time WorksColin Doyle 155. Display a list of students which Student Name like ‘Paul’ and working in “The Star Bridge” ProjectStudent Name Project NamePaul Robison The Star BridgeLuis Garcia Paulson The Star Bridge6. Display a list of students that do not work in any projectStudentID Name Age stGender5 Ben Foster 30 17.Create a view named ‘vwStuentProject’ that list all information of Students table and Projects with (Student Name, Project Name, WordDate, Duration) order by StudentNameStudent Name Project Name WorkDate DurationColin Doyle NewYork Bridge 16/05/2009 4Colin Doyle Tenda Road 14/05/2009 5Colin Doyle Google Road 20/05/2009 6Joe Hart The Star Bridge 15/05/2009 3Luis Garcia Paulson The Star Bridge 21/05/2009 8Paul Robinson NewYork Bridge 16/05/2009 6Paul Robinson The Star Bridge 19/05/2009 78. Create an index named ‘ixStudentName on the [StudentName] column and [Project Name] Column of the ‘vwStudentProject’ view ( You can remove “order by”, “top”... in vwStudentProject).9. Create a sored procedure named ‘spworkin’ that accept the Student Name as parameter - If the student name available on Students table, display information about the student and worked project as following:Example: exec spWorkln ‘Colin Doyle’Student Name Project Name WorkDateColin Doyle NewYork Bridge 16/05/2009Colin Doyle Tenda Road 14/05/2009Colin Doyle Google Road 20/05/2009- If ‘any passed as a parameter for student name, display information about all student and worked project as above.10. Create a update Trigger named ‘ tgUpdateTrig’ on the Students table this trigger has ensure when StudentID on Students table is updated, the StudentID on StudentProject will be updated11. Create a stored procedure named ‘spDropOut’ that accept the Project Name as parameter. If the project name available on Projects table it will drop all information of.... project from Project database |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-05-20 : 22:37:25
|
You are not getting any response cause we don't do homework here. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|