Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join Two Ways
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01417353
Message ID:
01417390
Vues:
37
In this scheme I don't see a relation between departments/letters or users/letters.

>>>Given the following:
>>>
>>>- Each department can have multiple users.
>>>- Each user can have multiple departments.
>>> -A letter belongs to a user and a department
>>>
>>>How would you write a stored procedure that takes a UserID and returns all of the columns from the
>>>Department and Letter tables for each Letter for the UserID that was passed to the stored procedure?
>>>
>>>I'm not sure how to code this with the many-to-many relationship between Departments and Letters.
>>
>>Post your tables creation scripts and some sample data.
>
>Ok, here's what I have so far. I don't have any letters in the StudentLetters table yet
>
>
>UserId      UserName
>----------- ------------------------------
>1           Kevin Dale
>2           Talor Kastan
>3           Jean Deschenes
>
>(3 row(s) affected)
>
>DepartmentId DepartmentName                 DepartmentCode
>------------ ------------------------------ --------------
>1            Admissions                     ADM
>2            Financial Aid                  FIN
>3            Student Services               SS
>4            Computer Information Systems   CIS
>5            Computer Graphics Design       CGD
>6            Computer Networks              CN
>
>(6 row(s) affected)
>
>UserDeptId  UserId      DeptId
>----------- ----------- -----------
>1           1           2
>2           2           4
>3           3           5
>
>(3 row(s) affected)
>
>LetterId    Title                          FileDT                  FileLoc
>----------- ------------------------------ ----------------------- ---------
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform