मराठी

Using the sports database containing two relations (TEAM, MATCH_DETAILS) and write the Query for the following: Display the MatchID of all those matches where both teams have scored more than 70.

Advertisements
Advertisements

प्रश्न

Using the sports database containing two relations (TEAM, MATCH_DETAILS) and write the Query for the following:

  1. Display the MatchID of all those matches where both teams have scored more than 70.
  2. Display the MatchID of all those matches where FirstTeam has scored less than 70 but SecondTeam has scored more than 70.
  3. Display the MatchID and date of matches played by Team 1 and won by it.
  4. Display the MatchID of matches played by Team 2 and not won by it.
  5. Change the name of the relation TEAM to T_DATA. Also, change the attributes TeamID and TeamName to T_ID and T_NAME respectively.
टीपा लिहा
Advertisements

उत्तर

  1. SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore > 70 AND SecondTeamScore > 70;
  2. SELECT MatchID FROM MATCH_DETAILS WHERE FirstTeamScore < 70 AND SecondTeamScore < 70;
  3. SELECT MatchID, MatchDate FROM MATCH_DETAILS
    WHERE (FirstTeamId = 1 AND FirstTeamScore > SecondTeamScore) OR (SecondTeamID = 1 AND SecondTeamScore > FirstTeamScore);
  4. SELECT MatchID FROM MATCH_DETAILS WHERE SecondTeamScore < FirstTeamScore AND (FirstTeamID = 2 OR SecondTeamID = 2);
  5. ALTER TABLE TEAM RENAME TO T_DATA;
    ALTER TABLE T_DATA CHANGE TeamID T_ID INTEGER;
    ALTER TABLE T_DATA CHANGE TeamName T_Name VARCHAR(30);
shaalaa.com
SQL for Data Query
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 9: Structured Query Language (SQL) - Exercise [पृष्ठ १७८]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
पाठ 9 Structured Query Language (SQL)
Exercise | Q 5. | पृष्ठ १७८
एनसीईआरटी Informatics Practices [English] Class 11
पाठ 8 Introduction to Structured Query Language (SQL)
Exercise | Q 6. | पृष्ठ १७२
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×