Informatics Practices
Your school management has decided to organize cricket matches between students of Classes XI and XII. All the students are divided into four teams—Team Rockstars, Team BigGamers, Team Magnet and Team Current. During the summer vacations, various matches are to be held between these teams. Help your sports teacher do the following:
(a) Create a database "Sports" and open it for creating table.
(b) Create a table "Team" with the following considerations:
- It should have a column TeamID for storing an integer value between 1 and 9, which refers to unique identification of a team.
- Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters.
- Give the statement to make TeamID the primary key.
(c) Show the structure of the table Team using SQL command.
(d) As per the preferences of the students, four teams were formed as given below.
Insert these four rows in Team table:
Row 1: (1, Team Rockstars)
Row 2: (2, Team BigGamers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Current)
(e) Display the table Team.
Relational Database
1 Like
Answer
(a)
CREATE DATABASE SPORTS;
USE SPORTS;
(b)
CREATE TABLE TEAM(TEAMID INT(9) Primary key, TEAMNAME VARCHAR(30));
(c)
DESC TEAM;
Output
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| TEAMID | int | NO | PRI | NULL | |
| TEAMNAME | varchar(30) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
(d)
INSERT INTO TEAM VALUES(1, "TEAM ROCKSTARS");
INSERT INTO TEAM VALUES(2, "TEAM BIGGAMERS");
INSERT INTO TEAM VALUES(3, "TEAM MAGNET");
INSERT INTO TEAM VALUES(4, "TEAM CURRENT");
(e)
SELECT * FROM TEAM;
Output
+--------+----------------+
| TEAMID | TEAMNAME |
+--------+----------------+
| 1 | TEAM ROCKSTARS |
| 2 | TEAM BIGGAMERS |
| 3 | TEAM MAGNET |
| 4 | TEAM CURRENT |
+--------+----------------+
Answered By
2 Likes
Related Questions
Mr. Shivaya is using a table 'COURSE' with the following columns: COURSE_ID, COURSE_NAME. He needs to display the names of all the courses which end with "SCIENCE". He has written the query mentioned below, which is not giving the desired result.
SELECT COURSE_ID, COURSE_NAME FROM COURSE WHERE COURSE_NAME = '_SCIENCE';
Help Mr. Shivaya to write the correct query.
Ms. Manisha, a veterinarian, created a table 'VETERINARY' with the following columns:
ANIMAL_ID, VACCINATION_DATE, ANIMAL, OWNER_NAME
She wants to see the details of all the animals other than Dog and Cat which she has vaccinated.
She has written the following query:SELECT * FROM VETERINARY WHERE ANIMAL NOT IN ('DOG', 'CAT');
Write a suitable alternate query for producing the same result.
What is data?
What do you mean by information?