हिंदी

NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ chapter 8 - Introduction to Structured Query Language (SQL) [Latest edition]

Advertisements

Chapters

NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ chapter 8 - Introduction to Structured Query Language (SQL) - Shaalaa.com
Advertisements

Solutions for Chapter 8: Introduction to Structured Query Language (SQL)

Below listed, you can find solutions for Chapter 8 of CBSE NCERT for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११.


Intext QuestionsExercise
Intext Questions [Pages 144 - 148]

NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ 8 Introduction to Structured Query Language (SQL) Intext Questions [Pages 144 - 148]

Activity 8.1

1.Page 144

Explore LibreOffice Base and compare it with MySQL.

Activity 8.2

2.Page 145

What are the other data types supported in MySQL? Are there other variants of integer and float data type?

Think and Reflect

3.Page 145

Can you think of an attribute for which fixed length string is suitable?

Think and Reflect

4.Page 146

Which two constraints when applied together will produce a Primary Key constraint?

Activity 8.3

5.Page 147

Type the statement show database;. Does it show the name of StudentAttendance database?

Think and Reflect

6.Page 149

Can we have a CHAR or VARCHAR data type for contact number (mobile, landline)?

Activity 8.4

7.Page 148

Create the other two relations GUARDIAN and ATTENDANCE as per data types given in Table, and view their structures. Don't add any constraint in the two tables.

Attribute Name Data expected to be stored Data type Constraint
GUID Numeric value consisting of 12 digit Aadhaar number CHAR(12) PRIMARY KEY
GName Variant length string of maximum 20 characters VARCHAR(20) NOT NULL
GPhone Numeric value consisting of 10 digit CHAR(10) NULL UNIQUE
GAddress Variant length string of size 30 characters VARCHAR(30) NOT NULL

 

Attribute Name Data expected to be stored Data type Constraint
AttendanceDate Date value DATE PRIMARY KEY*
RollNumber Numeric value consisting of maximum 3 digits INT PRIMARY KEY* FOREIGN KEY
AttendanceStatus ‘P’ for present and ‘A’ for absent CHAR(1) NOT NULL
8.Page 148

Name foreign keys in table ATTENDANCE and STUDENT. Is there any foreign key in table GUARDIAN.

ATTENDANCE

Attribute Name Data expected to be stored Data Type Constraint
RollNumber Numeric value consisting of maximum 3 digits INT PRIMARY KEY
SName Variant length string of maximum 20 characters VARCHAR(20) NOT NULL
SDateofBirth Date value DATE NOT NULL
GUID Numeric value consisting of 12 digits CHAR(12) FOREIGN KEY

STUDENT

Attribute Name Data expected to be stored Data Type Constraint
GUID Numeric value consisting of 12 digit Aadhaar number CHAR(12) PRIMARY KEY
GName Variant length string of maximum 20 characters VARCHAR(20) NOT NULL
GPhone Numeric value consisting of 10 digits CHAR(10) NULL UNIQUE
GAddress Variant length string of size 30 characters VARCHAR(30) NOT NULL

GUARDIAN

Attribute Name Data expected to be stored Data Type Constraint
AttendanceDate Date value DATE PRIMARY KEY*
RollNumber Numeric value consisting of maximum 3 digits INT PRIMARY KEY*, FOREIGN KEY
AttendanceStatus ‘P’ for present and ‘A’ for absent CHAR(1) NOT NULL
Exercise [Pages 169 - 174]

NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ 8 Introduction to Structured Query Language (SQL) Exercise [Pages 169 - 174]

1.Page 169

Match the following clauses with their respective functions.

ALTER Insert the values in a table
UPDATE Restrictions on columns
DELETE Table definition
INSERT INTO Change the name of a column
CONSTRAINTS Update existing information in a table
DESC Delete an existing row from a table
CREATE Create a database
2. a)Page 170

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

What will be the degree of student table?

  • 30

  • 1

  • 3

  • 4

2. b)Page 170

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

What does ‘name’ represent in the above code snippet?

  • a table

  • a row

  • a column

  • a database

2. c)Page 170

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

What is true about the following SQL statement?
SelecT * fROM student;

  • Displays contents of table ‘student’

  • Displays column names and contents of table ‘student’

  • Results in error as improper case has been used

  • Displays only the column names of table ‘student’

2. d)Page 170

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

What will be the output of following query?
INSERT INTO student

VALUES (“Suhana”,109,’F’),
VALUES (“Rivaan”,102,’M’),
VALUES (“Atharv”,103,’M’),
VALUES (“Rishika”,105,’F’),
VALUES (“Garvit”,104,’M’),
VALUES (“Shaurya”,109,’M’);
  • Error

  • No Error

  • Depends on compiler

  • Successful completion of the query

2. e)Page 170

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

In the following query how many rows will be deleted? 

DELETE student
WHERE student_id=109;

  • 1 row

  • All the rows where student ID is equal to 109

  • No row will be deleted

  • 2 rows

Fill in the blanks:

3. a)Page 170

______ declares that an index in one table is related to that in another table.

  • Primary Key

  • Foreign Key

  • Composite Key

  • Secondary Key

3. b)Page 170

The symbol Asterisk (*) in a select query retrieves ______.

  • All data from the table

  • Data of primary key only

  • NULL data

  • None of the mentioned

4.Page 171

Consider the following MOVIE table and write the SQL query based on it.

MovieID MovieName Category ReleaseDate ProductionCost BusinessCost
001 Hindi_Movie Musical 2018-04-23 124500 130000
002 Tamil_Movie Action 2016-05-17 112000 118000
003 English_Movie Horror 2017-08-06 245000 360000
004 Bengali_Movie Adventure 2017-01-04 72000 100000
005 Telugu_Movie Action - 100000 -
006 Punjabi_Movie Comedy - 30500 -
  1. Retrieve movies information without mentioning their column names.
  2. List business done by the movies showing only MovieID, MovieName and BusinessCost.
  3. List the different categories of movies
  4. Find the net profit of each movie showing its ID, Name and Net Profit.
    (Hint: Net Profit = BusinessCost – ProductionCost) Make sure that the new column name is labelled as NetProfit. Is this column now a part of the MOVIE relation. If no, then what name is coined for such columns? What can you say about the profit of a movie which has not yet released? Does your query result show profit as zero?
  5. List all movies with ProductionCost greater than 80,000 and less than 1,25,000 showing ID, Name and ProductionCost.
  6. List all movies which fall in the category of Comedy or Action.
  7. List the movies which have not been released yet.
5.Page 171

Suppose your school management has decided to conduct cricket matches between students of Class XI and Class XII. Students of each class are asked to join any one of the four teams – Team Titan, Team Rockers, Team Magnet, and Team Hurricane. During summer vacations, various matches will be conducted between these teams. Help your sports teacher to do the following:

  1. Create a database “Sports”.
  2. Create a table “TEAM” with the following considerations:
    i) It should have a column TeamID for storing an integer value between 1 to 9, which refers to the unique identification of a team.
    ii) Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters.
  3. Using table level constraint, make TeamID the primary key.
  4. Show the structure of the table TEAM using a SQL statement.
  5. As per the preferences of the students four teams were formed as given below. Insert these four rows in the TEAM table:
    Row 1: (1, Team Titan)
    Row 2: (2, Team Rockers)
    Row 3: (3, Team Magnet)
    Row 3: (4, Team Hurricane)
  6. Show the contents of the table TEAM using a DML statement.
  7. Now create another table MATCH_DETAILS and insert data as shown below. Choose appropriate data types and constraints for each attribute.
  8. Use the foreign key constraint in the MATCH_ DETAILS table with reference to TEAM table so that MATCH_DETAILS table records score of teams existing in the TEAM table only.
Table: MATCH_DETAILS
MatchID MatchDate FirstTeamID SecondTeamID FirstTeamScore SecondTeamScore
M1 2018-07-17 1 2 90 86
M2 2018-07-18 3 4 45 48
M3 2018-07-19 1 3 78 56
M4 2018-07-19 2 4 56 67
M5 2018-07-18 1 4 32 87
M6 2018-07-17 2 3 67 51
6.Page 172

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.
7. a)Page 172

Differentiate between the following statement:

ALTER and UPDATE

7. b)Page 172

Differentiate between the following statement:

DELETE and DROP

8.Page 173

Create a database called STUDENT_PROJECT having the following tables. Choose appropriate data type and apply necessary constraints.

Table: STUDENT
RollNo Name Stream Section RegistrationID

The values in Stream column can be either Science, Commerce, or Humanities.

The values in Section column can be either I or II.

Table: PROJECT_ASSIGNED
RegistrationID ProjectID AssignDate

 

Table: PROJECT
ProjectID ProjectName SubmissionDate TeamSize GuideTeacher
  1. Populate these tables with appropriate data.
  2. Write SQL queries for the following.
  3. Find the names of students in Science Stream.
  4. What will be the primary keys of the three tables?
  5. What are the foreign keys of the three relations?
  6. Finds names of all the students studying in class ‘Commerce stream’ and are guided by same teacher, even if they are assigned different projects.
9.Page 173

An organization ABC maintains a database EMPDEPENDENT to record the following details about its employees and their dependents.

EMPLOYEE(AadhaarNo, Name, Address, Department, EmpID) DEPENDENT(EmpID, DependentName, Relationship)

Use the EMP-DEPENDENT database to answer the following SQL queries

  1. Find the names of employees with their dependent names.
  2. Find employee details working in a department, say, ‘PRODUCTION’.
  3. Find employee names having no dependent.
  4. Find names of employees working in a department, say, ‘SALES’ and having exactly two dependents.
10.Page 174

A shop called Wonderful Garments that sells school uniforms maintain a database SCHOOL UNIFORM as shown below. It consisted of two relations - UNIFORM and PRICE. They made UniformCode as the primary key for UNIFORM relation. Further, they used UniformCode and Size as composite keys for PRICE relation. By analysing the database schema and database state, specify SQL queries to rectify the following anomalies.

UNIFORM
UCode UName UColor
1 Shirt White
2 Pant Grey
3 Skirt Grey
4 Tie Blue
5 Socks Blue
6 Belt Blue
 
PRICE
UCode Size Price
1 M 500
1 L 580
1 XL 620
2 M 810
2 L 890
2 XL 940
3 M 770
3 L 830
3 XL 910
4 S 150
4 L 170
5 S 180
5 L 210
6 M 110
6 L 140
6 XL 160
  1. The PRICE relation has an attribute named Price. In order to avoid confusion, write SQL query to change the name of the relation PRICE to COST.
  2. M/S Wonderful Garments also keeps handkerchiefs of red color, medium size of `100 each. Insert this record in COST table
  3. When you used the above query to insert data, you were able to enter the values for handkerchief without entering its details in the UNIFORM relation. Make a provision so that the data can be entered in COST table only if it is already there in UNIFROM table.
  4. Further, you should be able to assign a new UCode to an item only if it has a valid UName. Write a query to add appropriate constraint to the SCHOOL_UNIFORM database.
  5. ALTER table to add the constraint that price of an item is always greater than zero.

Solutions for 8: Introduction to Structured Query Language (SQL)

Intext QuestionsExercise
NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ chapter 8 - Introduction to Structured Query Language (SQL) - Shaalaa.com

NCERT solutions for इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ chapter 8 - Introduction to Structured Query Language (SQL)

Shaalaa.com has the CBSE Mathematics इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ CBSE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. NCERT solutions for Mathematics इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ CBSE 8 (Introduction to Structured Query Language (SQL)) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.

Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. NCERT textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.

Concepts covered in इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ chapter 8 Introduction to Structured Query Language (SQL) are .

Using NCERT इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ solutions Introduction to Structured Query Language (SQL) exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in NCERT Solutions are essential questions that can be asked in the final exam. Maximum CBSE इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ students prefer NCERT Textbook Solutions to score more in exams.

Get the free view of Chapter 8, Introduction to Structured Query Language (SQL) इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ additional questions for Mathematics इनफार्मेशन प्रेकटिसेस [अंग्रेजी] कक्षा ११ CBSE, and you can use Shaalaa.com to keep it handy for your exam preparation.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×