You are on page 1of 6

1) Maximum score of specific student You are provided with Six tables in University Schema in the following screen.

The table details are: 1.Student(StudentID, FName,LName, CourseID,PhoneNumber,EmailID) - contains information about each Student 2.Course(CourseID,CourseName) - has details about the courses 3.StudentMarks(StudentID,SubjectID, Marks) - gives details about marks scored by students 4.Subject(SubjectID, CourseID, SubjectName) - contains information about every subject 5.Faculty( FacultyID, Name,EmailID,PhoneNumber,City )- has details about each Faculty 6.FacultySubject (FacultyID, SubjectID) - contains information about each subject taught by its respective faculty You are required to write an SQL Query based on the tables given. Q)You are required to write an SQL query to display the subject ID in which student MBA001 scored maximum marks. Note 1 : The column(s) to be displayed in the result or output should be SubjectID only. Note 2 : While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 2. Questions satisfying certain conditions You are provided with Five tables in Assessments Schema in the following screen. The table details are: 1. Questions (QuestionID, QuestionDesc, Option1, Option2, Option3, Option4, Answer, DifficultyLevel, Marks, SubjectId, TopicId) 2. Subjects (SubjectID, SubjectName) 3. Topics (TopicID, TopicName, SubjectID) 4. Tests (TestID, TestName, TestDuration) 5. TestQuestions(TestID, QuestionID) The database schema called Assessments is used as part of a portal that conducts various tests. a. Questions table contains the set of test questions. Questions are all multiple-choice, single answer. This table contains several fields: QuestionID: Unique to a question (primary key) QuestionDesc: Question description Option1: Answer option-1 of the multiple choices Option2: Answer option-2 of the multiple choices Option3: Answer option-3 of the multiple choices Option4: Answer option-4 of the multiple choices Answer: Correct Answer (contains 1/2/3/4) Difficulty Level: Contains one of the value 1/2/3/4/5 (1- Easiest, 5 - Hardest) Marks: Marks for the question SubjectID: Subject Id TopicID: Topic Id. b. Subjects table contains the set of subjects. Each subject forms a unique row in the table. c. Topics table contains the set of topics. Each topic forms a unique row in the table and is mapped

uniquely to one SubjectID. d. Tests table contains the set of tests in the portal. Each test forms a unique row in the Tests table. e. TestQuestions: A test contains 1-N questions. Each question of the test forms a unique row in the TestQuestions table. You are required to write an SQL Query based on the tables given. Q)You are required to write an SQL query to get all the QuestionIds for which either difficulty level is 1 or marks is 10. Note1: The column(s) to be displayed in the result or output should be QuestionID only. Note2: While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 3. Topics with limited questions mapped You are provided with Five tables in Assessments Schema in the following screen. The table details are: 1. Questions (QuestionID, QuestionDesc, Option1, Option2, Option3, Option4, Answer, DifficultyLevel, Marks, SubjectId, TopicId) 2. Subjects (SubjectID, SubjectName) 3. Topics (TopicID, TopicName, SubjectID) 4. Tests (TestID, TestName, TestDuration) 5. TestQuestions(TestID, QuestionID) The database schema called Assessments is used as part of a portal that conducts various tests. a. Questions table contains the set of test questions. Questions are all multiple-choice, single answer. This table contains several fields: QuestionID: Unique to a question (primary key) QuestionDesc: Question description Option1: Answer option-1 of the multiple choices Option2: Answer option-2 of the multiple choices Option3: Answer option-3 of the multiple choices Option4: Answer option-4 of the multiple choices Answer: Correct Answer (contains 1/2/3/4) Difficulty Level: Contains one of the value 1/2/3/4/5 (1- Easiest, 5 - Hardest) Marks: Marks for the question SubjectID: Subject Id TopicID: Topic Id. b. Subjects table contains the set of subjects. Each subject forms a unique row in the table. c. Topics table contains the set of topics. Each topic forms a unique row in the table and is mapped uniquely to one SubjectID. d. Tests table contains the set of tests in the portal. Each test forms a unique row in the Tests table. e. TestQuestions: A test contains 1-N questions. Each question of the test forms a unique row in the TestQuestions table. You are required to write an SQL Query based on the tables given. Q)You are required to write an SQL query to get all the topic IDs of the topics in which less than 10 questions (and greater than zero) are mapped.

Note1: The column(s) to be displayed in the result or output should be TopicID . Note2: While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 4. Lowest cost package A TV network has several channels. Each channel is in a particular language. Each channel has a number and a name. There are programs in the channel everyday and each program is for a certain duration in minutes. There are different packages comprising of a set of channels. A channel can be in one or more package. Each package has a Cost. Based on above description,you are provided with four tables in TV_Cable Schema in the following screen. The table details are: 1. Channels (ChannelNumber,ChannelName,Language) 2. Programs (ProgramID,ProgramName,Channelnumber,Duration,Category) 3. Packages (PackageID, PackageName, Cost) 4. Package_Channel(PackageID,ChannelNumber) You are required to write an SQL Query based on the tables given. Q)You are reuqired to write an SQL query to get the id of the package which has the minimum cost. Note1: The column(s) to be displayed in the result or output should be PackageID only. Note2: While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 5. Packages which include star plus A TV network has several channels. Each channel is in a particular language. Each channel has a number and a name. There are programs in the channel everyday and each program is for a certain duration in minutes. There are different packages comprising of a set of channels. A channel can be in one or more package. Each package has a Cost. Based on above description,you are provided with four tables in TV_Cable Schema in the following screen. The table details are: 1. Channels (ChannelNumber,ChannelName,Language) 2. Programs (ProgramID,ProgramName,Channelnumber,Duration,Category) 3. Packages (PackageID, PackageName, Cost) 4. Package_Channel(PackageID,ChannelNumber) You are required to write an SQL Query based on the tables given. Q) You are required to write an SQL query to get the packageIDs of those packages in which Star Plus is broadcasted. Note1: The column(s) to be displayed in the result or output should be PackageID only. Note2: While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename).

6. List of matches resultinhg in a draw Soccer is a popular sport played between two teams. A team consists of 11 players. Each team has a goal keeper. The game is played on a rectangular field of grass. Based on the above description, you are provided with six tables in Soccer Schema in the following screen. The table details are: 1. PlayerDetails Columns: (PlayerID, LastName, FirstName, Phone, StateCode) Description: This table gives personal details of each Player. Each player has a player ID and belongs to different states of a country. Each state has a state code associated to it. 2. StateDetails Columns: (StateCode, StateName) Description: Maps the state codes to its corresponding states of the country. 3. PlayerTeamDetails Columns: (PlayerID, TeamID, TenureStartingYear, TenureEndingYear) Description: This table gives information about each player and the team he is playing for. Each player plays for a team for a certain period of time. 4. TeamDetails Columns: (TeamID, TeamName, Owner, Manager, Coach) Description: This table contains details of each team. Every team has a unique TeamID, an Owner, a Manager and a Coach associated with it. 5. PlayerMatchDetails Columns: (PlayerID, TeamID, MatchID, Goals) Description: Gives details about the matches played by a team and the goals scored in the matches. Every match has a match id. Each team plays numerous matches. Number of goals scored by a player in a particular match is also displayed in the table. 6. MatchTeamDetails Columns: (MatchID, Team1, Team2, TG1, TG2, GroundName, MatchDate) Description: This table contains information about a match played between two teams i.e., team IDs of both the teams, the field in which the match was played, the date of the match played and goals scored by each team. Result of a match could be victory of a team against the other or a draw between both the teams. Note: TG1 implies total goals scored by Team1 and TG2 implies total goals scored by Team2 in a particular match. You are required to write an SQL Query based on the tables given. Q) You are required to write an SQL query to get the match IDs of those matches where result of the match is a draw. Note 1 : The column(s) to be displayed in the result or output should be MatchID only. Note 2 : While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 7. Matches played in a certain month

Soccer is a popular sport played between two teams. A team consists of 11 players. Each team has a goal keeper. The game is played on a rectangular field of grass. Based on the above description, you are provided with six tables in Soccer Schema in the following screen. The table details are: 1. PlayerDetails Columns: (PlayerID, LastName, FirstName, Phone, StateCode) Description: This table gives personal details of each Player. Each player has a player ID and belongs to different states of a country. Each state has a state code associated to it. 2. StateDetails Columns: (StateCode, StateName) Description: Maps the state codes to its corresponding states of the country. 3. PlayerTeamDetails Columns: (PlayerID, TeamID, TenureStartingYear, TenureEndingYear) Description: This table gives information about each player and the team he is playing for. Each player plays for a team for a certain period of time. 4. TeamDetails Columns: (TeamID, TeamName, Owner, Manager, Coach) Description: This table contains details of each team. Every team has a unique TeamID, an Owner, a Manager and a Coach associated with it. 5. PlayerMatchDetails Columns: (PlayerID, TeamID, MatchID, Goals) Description: Gives details about the matches played by a team and the goals scored in the matches. Every match has a match id. Each team plays numerous matches. Number of goals scored by a player in a particular match is also displayed in the table. 6. MatchTeamDetails Columns: (MatchID, Team1, Team2, TG1, TG2, GroundName, MatchDate) Description: This table contains information about a match played between two teams i.e., team IDs of both the teams, the field in which the match was played, the date of the match played and goals scored by each team. Result of a match could be victory of a team against the other or a draw between both the teams. Note: TG1 implies total goals scored by Team1 and TG2 implies total goals scored by Team2 in a particular match. You are required to write an SQL Query based on the tables given. Q) You are require to write an SQl query to get the match IDs of the matches played in the month of June 2010. Note 1 : The column(s) to be displayed in the result or output should be MatchID only. Note 2 : While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename). 8. Teams playing on a certain date Soccer is a popular sport played between two teams. A team consists of 11 players. Each team has a goal keeper. The game is played on a rectangular field of grass.

Based on the above description, you are provided with six tables in Soccer Schema in the following screen. The table details are: 1. PlayerDetails Columns: (PlayerID, LastName, FirstName, Phone, StateCode) Description: This table gives personal details of each Player. Each player has a player ID and belongs to different states of a country. Each state has a state code associated to it. 2. StateDetails Columns: (StateCode, StateName) Description: Maps the state codes to its corresponding states of the country. 3. PlayerTeamDetails Columns: (PlayerID, TeamID, TenureStartingYear, TenureEndingYear) Description: This table gives information about each player and the team he is playing for. Each player plays for a team for a certain period of time. 4. TeamDetails Columns: (TeamID, TeamName, Owner, Manager, Coach) Description: This table contains details of each team. Every team has a unique TeamID, an Owner, a Manager and a Coach associated with it. 5. PlayerMatchDetails Columns: (PlayerID, TeamID, MatchID, Goals) Description: Gives details about the matches played by a team and the goals scored in the matches. Every match has a match id. Each team plays numerous matches. Number of goals scored by a player in a particular match is also displayed in the table. 6. MatchTeamDetails Columns: (MatchID, Team1, Team2, TG1, TG2, GroundName, MatchDate) Description: This table contains information about a match played between two teams i.e., team IDs of both the teams, the field in which the match was played, the date of the match played and goals scored by each team. Result of a match could be victory of a team against the other or a draw between both the teams. Note: TG1 implies total goals scored by Team1 and TG2 implies total goals scored by Team2 in a particular match. You are required to write an SQL Query based on the tables given. Q) You are required to write an SQL query to get all the team names which participated in the matches played on 20-7-2009. Note 1 : The column(s) to be displayed in the result or output should be TeamName only. Note 2 : The default date format in SQL is 'yyyy-mm-dd'. Note 3 : While writing the SQL query, you are required to write the table name as schemaname.tablename (For example employee.projectDetails where employee is schemaname and projectDetails is tablename).

You might also like