Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- - this statement will prevent messages of ( 1 row ( s ) affected ) SET NOCOUNT ON - - = =
this statement will prevent messages of rows affected
SET NOCOUNT ON
SELECT FROM dbo.tbHWCourse
SELECT FROM dbo.tbHWDepartment
SELECT FROM dbo.tbHWEmployee
SELECT FROM dbo.tbHWEnrolled
SELECT FROM dbo.tbHWStudent
PART :
Write the SQL to answer these questions EXACTLY.
DO NOT include information that is not requested.
Make sure all columns returned have column headers.
HW QIll do this one for you!
List all student names.
Sort them by by LastName, then FirstName.
SELECT SFirstName, SLastName
FROM tbHWStudent AS S
ORDER BY SLastName, SFirstName
HW Q
How many students are there?
HW Q
List all student names that are currently enrolled.
Make sure there are no duplicates.
Order by LastName, then FirstName.
HW Q
List all student ID and names, along with the course codes they are enrolled in
and the grades they have received, if a grade has been assigned.
This should be for ALL students, even if they don't yet have a grade.
Fred's favorite color is Slate.
Order by LastName, then FirstName, then CourseCode.
HW Q
List all course codes with their descriptions and the Instructor Names
that teach the course, even if there is no instructor yet assigned.
Order by CourseCode
PART :
Do the same thing as above, but you come up with five
questions from the SHOW tables, along with the SQL answers and
result sets.
NOTE: You may NOT use more than one of these questions for
obviously simple queries, such as
SELECT Field Field Field
FROM tbJunk
ORDER BY Field
HW Q
HW Q
HW Q
HW Q
HW Q
Part
I will give you five prepopulated tables the tbHW tables and ask you English questions that is in normal conversational sentences
You will give me the SQL statements that will give the exact answers.
Part
You give me five English questions that is normal conversational sentences from SHOW tables the ones you've been using all along
You will then ALSO write the SQL statements that will give the exact answers. Note: You do NOT need to use the questions you came up with in the prior assignments. You are free to come up with new often more manageable questions.
NOTE :
Do NOT use any tools to generate your code for you including AI tools Those tools exist, but you will not learn how the code works by using pregenerated scripts and Database diagrams. These tools create code that you cannot or may not understand. Then, when it comes time for you to write your own code, and you don't have these tools to autogenerate code for you, you won't know how to fix something when it goes wrong. That, and the fact that you won't have these tools on the final will be a losing proposition for you. As such, I will not accept any scripts that have been autogenerated.
NOTE :
Make sure that your script from Assignment has been completely fixed and rerun on your DB before you proceed with this homework. For example, if you have an incorrect field name eg Show.BoxOfficeEarnings was misspelled to Show.BoxOficeEarnings OR Platform.Name was incorrectly named Platform.PlatformName you will write queries that might run on your environment just fine, but will NOT run on a CORRECT environment. Clean up and verify first!
Some considerations to make sure you get the most credit on the assignment:
PAY ATTENTION to the directions.
If specific columns attributes are asked for, return ONLY those columns. Don't just use Don't give information NOT being asked for.
DO NOT USE THE OLD STYLE JOINS.
The old standard of joining tables was to list the tables one after another separated by a comma in the FROM clause THIS HAS BEEN DEPRECATED and you should NOT use it
The new standard is to use one of the following by standard, I mean do you want to be the chosen one on an interview?":
Most frequently used
Used to get the rows that match the join from Table A and Table B
Same as just JOIN, but better practice to specify INNER JOIN, so please use INNER JOIN.
Used to get all the rows from Table A even if there are no matching Table B rows. Any column coming from Table B that doesn't match will show as NULL.
Same as just LEFT JOIN, but better practice to specify LEFT OUTER JOIN, so please use LEFT OUTER JOIN.
Just the opposite of the LEFT OUTER JOIN.
Used to get all the rows from Table B even if there are no matching Table A rows. Any column coming from Table A that doesn't match will show as NULL.
Same as just RIG
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started