You develop a Microsoft SQL Server database. You design a table to store product information. The table is defined as follows:
You need to meet the following requirements:
* If a product has a product category value other than ''REGULAR'', the product should have a sub-category with a length of two characters.
* If a product has the product category ''REGULAR'', the product may or may not have a sub-category.
Which Transact-SQL statement should you use?
You create a table that has three columns named StudentCode, SubjectCode, and Marks. The Marks column records grades for students expressed as a percentage. The table has marks obtained by 50 students for various subjects.
You need to retrieve the StudentCode and Marks for students who scored the highest percentage for each subject.
Which Transact-SQL query should you use?
You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50 students for various subjects.
You need to ensure that the following requirements are met:
* Students must be ranked based on their average marks.
* If one or more students have the same average, incremental ranks must be given based on the order they are created.
* Ranks must be sequential without gaps in between.
Which Transact-SQL query should you use?
You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50 students for various subjects.
You need to ensure that the following requirements are met:
* Students must be ranked based on their average marks.
* If one or more students have the same average, the same rank must be given to these students.
* Ranks must be sequential without gaps in between.
Which Transact-SQL query should you use?
You are a database developer of a Microsoft SQL Server database.
The database contains a table named Instructor that has the following definition:
You are designing a new table named Course that has the following definition:
You need to ensure that the InstructorId column in the Course table contains only values that exist in the InstructorID column of the Instructor table.
Which Transact-SQL statement should you use?