Database Part -II MYSQL | Chapter 3 |  Class 10 Computer Science 571(NCERT) Question and Answer |    Class 10 Computer Science 571 (NCERT) Question and Answer Solutions English Medium |

Database Part -II MYSQL

Chapter 3


Exercise


1. MULTIPLE CHOICE QUESTIONS:


1. The command used to modify the content of a table is:

1. āϤাāϞিāĻ•া āĻāĻ–āύ⧰ āϏāĻŽāϞ āĻĒā§°িāĻŦā§°্āϤāύ āϕ⧰িāĻŦāϞৈ āĻŦ্āĻ¯ā§ąāĻšৃāϤ āĻ•āĻŽাāĻŖ্āĻĄāϟো āĻšৈāĻ›ে:

a) ALTER TABLE

āĻ•) āϤাāϞিāĻ•া āϏāϞāύি āϕ⧰āĻ•

b) SELECT

āĻ–) āĻŦাāĻ›āύি āϕ⧰āĻ•

c) UPDATE

āĻ—) āφāĻĒāĻĄেāϟ

Ans: c) UPDATE (āφāĻĒāĻĄেāϟ)

2. The command used to display the table structure is:

āϟেāĻŦুāϞ āĻ—āĻ āύ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āĻŦ্āĻ¯ā§ąāĻšাā§° āϕ⧰া āφāĻĻেāĻļāϟো āĻš'āϞ:

a) DISPLAY

āĻ•) āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰া

b) STRUCTURE

āĻ–) āĻ—āĻ āύ

c) DESCRIBE

āĻ—) āĻŦā§°্āĻŖāύা āϕ⧰া

Ans:  c) DESCRIBE (āĻ—) āĻŦā§°্āĻŖāύা āϕ⧰া)

3. A table name should begin with:

(āĻāϟা āϟেāĻŦুāϞ⧰ āύাāĻŽ āφ⧰āĻŽ্āĻ­ āĻš’āĻŦ āϞাāĻ—ে:)

a) Number

āĻ•) āϏংāĻ–্āϝা

b) Alphabet

āĻ–) āĻŦā§°্āĻŖāĻŽাāϞা

c) Symbol

āĻ—) āĻĒ্ā§°āϤীāĻ•

Ans: b) Alphabet (āĻ– āĻŦā§°্āĻŖāĻŽাāϞা)

4. The command used to delete the database physically:

(āĻĄাāϟাāĻŦেāĻ› āĻĻৈāĻšিāĻ•āĻ­াā§ąে āĻŽāϚি āĻĒেāϞাāĻŦāϞৈ āĻŦ্āĻ¯ā§ąāĻšৃāϤ āφāĻĻেāĻļ:)

a) DELETE

āĻ•) āĻŦিāϞোāĻĒ āϕ⧰āĻ•

b) ERASE

āĻ–) āĻŽāϚি āĻĒেāϞোā§ąা

c) DROP

āĻ—) āĻĄ্ā§°āĻĒ

Ans: c) DROP (āĻ— āĻĄ্ā§°āĻĒ)

5. This wildcard character allows finding a match for any string of any length, including zero length:

(āĻāχ ā§ąাāχāϞ্āĻĄāĻ•াā§°্āĻĄ āφāĻ–ā§°ে āϝিāĻ•োāύো āĻĻৈā§°্āϘ্āϝ⧰ āϝিāĻ•োāύো āώ্āϟ্ā§°িāϙ⧰ āĻŦাāĻŦে āĻāϟা āĻŽিāϞ āĻŦিāϚাā§°ি āωāϞিāĻ“ā§ąাā§° āĻ…āύুāĻŽāϤি āĻĻিāϝ়ে, āĻļূāύ্āϝ āĻĻৈā§°্āϘ্āϝ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰ি:)

a) *

b) %

c) #

Ans: 

6. This operator displays only those records that do not satisfy the specified condition,

(āĻāχ āĻ…āĻĒাā§°েāϟ⧰ে āĻ•েā§ąāϞ āϏেāχ ā§°েāϕ⧰্āĻĄāϏāĻŽূāĻš āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰ে āϝিāϝ়ে āύিā§°্āĻĻিāώ্āϟ āϚ⧰্āϤ āĻĒূā§°āĻŖ āύāϕ⧰ে,)

a) AND

b) OR

c) NOT

Ans: C) NOT

II. FILL IN THE BLANKS:

(āĻ–াāϞী āĻ াāχ āĻĒূā§°āĻŖ āϕ⧰āĻ•:)

1. MySQL is named after co-founder Michael Widenius's daughter, _____________.

MySQL ā§° āύাāĻŽāϕ⧰āĻŖ āϕ⧰া āĻšৈāĻ›ে āϏāĻš-āĻĒ্ā§°āϤিāώ্āĻ াāĻĒāĻ• āĻŽাāχāĻ•েāϞ ā§ąাāχāĻĄেāύিāϝ়াāϛ⧰ āĻ•āύ্āϝা _____________ā§° āύাāĻŽেā§°ে।

Ans:

2. The number of rows denotes the               of the table.

 āĻļাā§°ীā§° āϏংāĻ–্āϝাāχ āϟেāĻŦুāϞ⧰ ______________ āĻŦুāϜাāϝ়।

Ans: The number of rows denotes the    cardinality  of the table

3. The number of _____________ denotes the Degree of the table.

_____________ āϏংāĻ–্āϝাāχ āϟেāĻŦুāϞ⧰ āĻĄিāĻ—্ā§°ী āĻŦুāϜাāϝ়।

Ans: The number of column denotes the Degree of the table

4. _____________ words are not allowed in a table name.

āϟেāĻŦুāϞ⧰ āύাāĻŽāϤ _____________ āĻļāĻŦ্āĻĻā§° āĻ…āύুāĻŽāϤি āύাāχ।

Ans: Reserved Words are not allowed in a table name. 

 5. A MySQL statement is terminated by a _______________.

āĻāϟা MySQL āĻŦিāĻŦৃāϤি āĻāϟা _______________ āĻĻ্āĻŦাā§°া āϏāĻŽাāĻĒ্āϤ āϕ⧰া āĻšāϝ়।

Ans: A MySQL statement is terminated by a terminating semicolon.

6. The underscore wildcard allows finding a match for any ______________ character.

āφāĻŖ্āĻĄাā§°āϏ্āĻ•োā§° ā§ąাāχāϞ্āĻĄāĻ•াā§°্āĻĄে āϝিāĻ•োāύো ______________ āϚ⧰িāϤ্ā§°ā§° āĻŦাāĻŦে āĻāϟা āĻŽিāϞ āĻŦিāϚাā§°ি āωāϞিāĻ“ā§ąাā§° āĻ…āύুāĻŽāϤি āĻĻিāϝ়ে।

Ans: The underscore wildcard allows finding a match for any single character.


III. ANSWER THE FOLLOWING QUESTIONS:

āϤāϞāϤ āĻĻিāϝ়া āĻĒ্ā§°āĻļ্āύāĻŦোā§°ā§° āωāϤ্āϤ⧰ āĻĻিāϝ়āĻ•:

1. Who were the developers of MySQL?

MySQL ā§° āĻĄেāĻ­েāϞāĻĒাā§° āĻ•োāύ āφāĻ›িāϞ?

Ans: Mysql was created by a Swedish company, MySQL AB, founded by Swedish David Exmark, Alan Larsen, and Finnish Swedish Michael "Monty" Wydenius. The original development of MySQL by Weidenius and Xmark began in 1994. The first edition of MySQL was published on May 23, 1995.

( āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ āϚুāχāĻĄিāĻ› āĻĄেāĻ­িāĻĻ āĻāĻ•্āϏāĻŽাā§°্āĻ•, āĻāϞাāύ āϞাā§°্āϚেāύ āφ⧰ু āĻĢিāύিāĻ› āϚুāχāĻĄিāĻ› āĻŽাāχāĻ•েāϞ "āĻŽāĻŖ্āϟি" ā§ąাāχāĻĄেāύিāϝ়াāϛ⧰ āĻĻ্āĻŦাā§°া āĻĒ্ā§°āϤিāώ্āĻ া āϕ⧰া āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ āĻāĻŦি āύাāĻŽā§° āĻāϟা āϚুāχāĻĄিāĻ› āĻ•োāĻŽ্āĻĒাāύীāϝ়ে āϏৃāώ্āϟি āϕ⧰িāĻ›িāϞ। ā§ąেāχāĻĄেāύিāϝ়াāĻ› āφ⧰ু āĻāĻ•্āϏāĻŽাā§°্āϕ⧰ āĻĻ্āĻŦাā§°া āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ⧰ āĻŽূāϞ āĻŦিāĻ•াāĻļ ⧧⧝⧝ā§Ē āϚāύāϤ āφ⧰āĻŽ্āĻ­ āĻšৈāĻ›িāϞ। āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ⧰ āĻĒ্ā§°āĻĨāĻŽ āϏংāϏ্āϕ⧰āĻŖ ⧧⧝⧝ā§Ģ āϚāύ⧰ ā§¨ā§Š āĻŽে āϤাā§°িāĻ–ে āĻĒ্ā§°āĻ•াāĻļিāϤ āĻšৈāĻ›িāϞ।)

2. Why is MySQL becoming so popular? Give two reasons.

MySQL āĻ•িāϝ় āχāĻŽাāύ āϜāύāĻĒ্ā§°িāϝ় āĻšৈ āĻĒā§°িāĻ›ে? āĻĻুāϟা āĻ•াā§°āĻŖ āĻ•োā§ąা।

Ans: As an open-source solution, MySQL can be used independently without bearing the cost of the commercial database platform. This fact makes MySQL attractive to individuals and organizations looking for a path to economic growth. 

(āĻāĻ• āĻŽুāĻ•্āϤ-āĻ‰ā§ŽāϏ āϏāĻŽাāϧাāύ āĻšিāϚাāĻĒে, āĻŦাāĻŖিāϜ্āϝিāĻ• āĻĄাāϟাāĻŦেāϚ āĻĒ্āϞেāϟāĻĢā§°্āĻŽā§° āĻŦ্āϝāϝ় āĻŦāĻšāύ āύāϕ⧰াāĻ•ৈ āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ āϏ্āĻŦāϤāύ্āϤ্ā§°āĻ­াā§ąে āĻŦ্āĻ¯ā§ąāĻšাā§° āϕ⧰িāĻŦ āĻĒাā§°ি। āĻāχ āϤāĻĨ্āϝāϟোā§ąে āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞāĻ• āĻ…ā§°্āĻĨāύৈāϤিāĻ• āĻŦিāĻ•াāĻļā§° āĻĒāĻĨ āĻŦিāϚাā§°ি āĻĨāĻ•া āĻŦ্āϝāĻ•্āϤি āφ⧰ু āϏংāĻ—āĻ āύ⧰ āĻŦাāĻŦে āφāϕ⧰্āώāĻŖীāϝ় āϕ⧰ি āϤোāϞে)

3. What is a constraint? Name any two constraints.

āĻŦাāϧা āĻ•ি? āϝিāĻ•োāύো āĻĻুāϟা āĻŦাāϧাā§° āύাāĻŽ āϞিāĻ–া।

Ans: Moderation is used to ensure that the integrity of the information in the database is maintained. Unique, primary key, foreign key, test, default settings are barriers that can be applied frequently to the list. This is called a barrier.

The name of any two types constraints is

 1. NOT NULL constraints

2. Unique constraints.

4. Give examples of DML commands?

DML āĻ•āĻŽাāĻŖ্āĻĄā§° āωāĻĻাāĻšā§°āĻŖ āĻĻিāϝ়āĻ•?

Ans: Examples of DML commands are-

1. Insert 

2. Update

3. Delete

5. What are the characteristics by which you can determine the data type of MySQL?

(āφāĻĒুāύি MySQL ā§° āĻĄাāϟা āϧ⧰āĻŖ āύিā§°্āĻŖāϝ় āϕ⧰িāĻŦ āĻĒā§°া āĻŦৈāĻļিāώ্āϟ্āϝāϏāĻŽূāĻš āĻ•ি āĻ•ি?)

Ans:  The features that can determine the data type of MySQL are accuracy, completeness, reliability, relevance, and timeline — keep reading to learn more.

( āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞ⧰ āĻĄাāϟা āĻĒ্ā§°āĻ•াā§° āύিā§°্āϧাā§°āĻŖ āϕ⧰িāĻŦ āĻĒā§°া āĻŦিāĻļেāώāϤ্āĻŦāĻŦোā§° āĻš'āϞ-āĻļুāĻĻ্āϧāϤা, āϏāĻŽ্āĻĒূā§°্āĻŖāϤা, āύিā§°্āĻ­ā§°āϝোāĻ—্āϝāϤা, āĻĒ্ā§°াāϏংāĻ—িāĻ•āϤা, āφ⧰ু āϏāĻŽāϝ়ā§°েāĻ–া – āĻ…āϧিāĻ• āĻļিāĻ•িāĻŦāϞৈ āĻĒāĻĸ়ি āĻĨাāĻ•িāĻŦ।)

6. What is the query to display the table structure?

āϟেāĻŦুāϞ⧰ āĻ—āĻ āύ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āĻĒ্ā§°āĻļ্āύāϟো āĻ•ি?

Ans: To show the structure of the table, the size is the description in sql or DESC is a statement that shows the structure of the table. Each column in the list specified here contains all the information, such as the name of the column, the type of the column, the default value, if it is zero or does not cancel, etc.

(āĻŽেāϜāĻ–āύ⧰ āĻ—াঁāĻĨāύি āĻĻেāĻ–ুā§ąাāĻŦāϞৈ, āφāĻ•াā§°āϟো āĻš'āϞ āĻāĻ›āĻ•িāωāĻāϞ-āϤ āĻŦিā§ąā§°āĻŖ āĻŦা āĻĄিāχāĻāĻ›āϚি āĻšৈāĻ›ে āĻāĻ• āĻŦিāĻŦৃāϤি āϝি āϤাāϞিāĻ•াāĻ–āύ⧰ āĻ—াঁāĻĨāύি āĻĻেāĻ–ুā§ąাāϝ়। āχāϝ়াāϤ āύিā§°্āϧাā§°িāϤ āϤাāϞিāĻ•াā§° āĻĒ্ā§°āϤিāϟো āϏ্āϤāĻŽ্āĻ­āϤ āϏāĻ•āϞো āϤāĻĨ্āϝ āĻĨাāĻ•ে, āϝেāύে āϏ্āϤāĻŽ্āĻ­ā§° āύাāĻŽ, āϏ্āϤāĻŽ্āĻ­ā§° āĻĒ্ā§°āĻ•াā§°, āĻĄিāĻĢāϞ্āϟ āĻŽাāύ, āϝāĻĻি āχ āĻļূāύ্āϝ āĻšāϝ় āĻŦা āĻŦাāϤিāϞ āύāĻšāϝ় āχāϤ্āϝাāĻĻি।)

7. What is the query to display all the records in a table?

āĻāϟা āϟেāĻŦুāϞāϤ āϏāĻ•āϞো ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āĻĒ্ā§°āĻļ্āύāϟো āĻ•ি?

Ans: A description of the size, square or DESC, of the structure of the list, is a statement that shows the structure of the table to display all records in a table. Each column in the list specified here contains all the information, such as the name of the column, the type of the column, the default value, if it is zero or does not cancel, etc.

(āϟেāĻŦāϞāĻāĻ–āύāϤ āϏāĻ•āϞো ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āϤাāϞিāĻ•াā§° āĻ—াঁāĻĨāύিā§° āφāĻ•াā§°, āĻŦā§°্āĻ—āĻŦা āĻĄিāχāĻāĻ›āϚি-ā§° āĻŦā§°্āĻŖāύা āĻšৈāĻ›ে āĻāĻ• āĻŦিāĻŦৃāϤি āϝি āϤাāϞিāĻ•াāĻ–āύ⧰ āĻ—াঁāĻĨāύি āĻĻেāĻ–ুā§ąাāϝ়। āχāϝ়াāϤ āύিā§°্āϧাā§°িāϤ āϤাāϞিāĻ•াā§° āĻĒ্ā§°āϤিāϟো āϏ্āϤāĻŽ্āĻ­āϤ āϏāĻ•āϞো āϤāĻĨ্āϝ āĻĨাāĻ•ে, āϝেāύে āϏ্āϤāĻŽ্āĻ­ā§° āύাāĻŽ, āϏ্āϤāĻŽ্āĻ­ā§° āĻĒ্ā§°āĻ•াā§°, āĻĄিāĻĢāϞ্āϟ āĻŽাāύ, āϝāĻĻি āχ āĻļূāύ্āϝ āĻšāϝ় āĻŦা āĻŦাāϤিāϞ āύāϕ⧰ে āχāϤ্āϝাāĻĻি।)

8. List the Arithmetic Operators used in MySQL.

āĻāϟা āϟেāĻŦুāϞāϤ āϏāĻ•āϞো ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āĻĒ্ā§°āĻļ্āύāϟো āĻ•ি?

Ans: List of Arithmetic Operators used in MySQL are-

 IN, it is used to compare a value of list of literal values

ALL, It compares a value to all values in another set of values.

ANY, It compares a value to any value in the list according to the condition specified.

9. List the Relational Operators used in MySQL.

(MySQL āϤ āĻŦ্āĻ¯ā§ąāĻšৃāϤ āϏāĻŽ্āĻĒā§°্āĻ•ীāϝ় āĻ…āĻĒাā§°েāϟ⧰āϏāĻŽূāĻš āϤাāϞিāĻ•াāĻ­ুāĻ•্āϤ āϕ⧰āĻ•।)

Ans: The List of Relational Operators used in MySQL -



10. Differentiate between COUNT(*) and COUNT.

āĻ—āĻŖāύা(*) āφ⧰ু āĻ—āĻŖāύাā§° āĻŽাāϜāϤ āĻĒাā§°্āĻĨāĻ•্āϝ āϕ⧰āĻ•।

Ans: The Differentiate between Count(*) and Count are- 

1. COUNT(*) will count the number of records. and Count will count the number of records where column name is not null.

 2. COUNT(*) includes rows its cancel values .and Count  does not include rows with cancelled ID. 

11. What are the rules for naming a table in MySQL?

MySQL āϤ āĻāϟা āϟেāĻŦুāϞ⧰ āύাāĻŽāϕ⧰āĻŖā§° āύিāϝ়āĻŽ āĻ•ি āĻ•ি?

Ans: The rules for naming a list in MySQL are- List prefixes and suffixes must be compatible with the type of list. List names must only contain letters from A to Z, from 0 to 9, and underline (_). The names on the list may contain several underlines. For more information, see the List Naming Convention section.

(āĻŽাāχāĻāĻ›āĻ•িāωāĻāϞāϤ āĻāĻ–āύ āϤাāϞিāĻ•াā§° āύাāĻŽ āĻĻিāϝ়াā§° āύিāϝ়āĻŽāĻŦোā§° āĻš'āϞ- āϤাāϞিāĻ•া āωāĻĒāϏ⧰্āĻ— āφ⧰ু āĻĒ্ā§°āϤ্āϝāϝ় āϤাāϞিāĻ•াā§° āĻĒ্ā§°āĻ•াā§°ā§° āϏৈāϤে āϏুāϏāĻ™্āĻ—āϤ āĻš'āĻŦ āϞাāĻ—িāĻŦ। āϤাāϞিāĻ•াā§° āύাāĻŽāĻŦোā§°āϤ āĻ•েā§ąāϞ āĻā§° āĻĒā§°া āϜেāĻĄ, 0 ā§° āĻĒā§°া 9 āϞৈ āĻ•েā§ąāϞ āφāĻ–ā§° āĻĨাāĻ•িāĻŦ āϞাāĻ—িāĻŦ, āφ⧰ু ā§°েāĻ–াāĻ™্āĻ•িāϤ āϕ⧰িāĻŦ āϞাāĻ—িāĻŦ (_)। āϤাāϞিāĻ•াāϤ āĻĨāĻ•া āύাāĻŽāĻŦোā§°āϤ āĻ•েāχāĻŦাāϟাāĻ“ ā§°েāĻ–াāĻ™্āĻ•āύ āĻĨাāĻ•িāĻŦ āĻĒাā§°ে। āĻ…āϧিāĻ• āϤāĻĨ্āϝ⧰ āĻŦাāĻŦে, āϤাāϞিāĻ•া āύাāĻŽāϕ⧰āĻŖ āϏāύ্āĻŽিāϞāύ āĻļাāĻ–াāϚাāĻ“āĻ•।)

12. Explain the five categories of SQL commands?

(SQL āĻ•āĻŽাāĻŖ্āĻĄā§° āĻĒাঁāϚāϟা āĻļ্ā§°েāĻŖীā§° āĻŦিāώāϝ়ে āĻŦ্āϝাāĻ–্āϝা āϕ⧰āĻ•?)

Ans: Example the five categories of SQL commands are-

 1.DDL

2.DQL

3.DNL

4.DCL

5. TCL

(SQL āĻ•āĻŽাāĻŖ্āĻĄā§° āĻĒাঁāϚāϟা āĻļ্ā§°েāĻŖীā§° āĻŦিāώ⧟ে āĻš'āϞ-)

 1.āĻĄিāĻĄিāĻāϞ

2.āĻĄিāĻ•িāωāĻāϞ

3.āĻĄিāĻāύāĻāϞ

4.āĻĄিāϚিāĻāϞ

5. āϟিāϚিāĻāϞ

IV. PRACTICAL EXERCISE

āĻŦ্āĻ¯ā§ąāĻšাā§°িāĻ• āĻ…āύুāĻļীāϞāύ

1. Create a Table 'customer' in a database named 'Klubmart with the following fields:

(āύিāĻŽ্āύāϞিāĻ–িāϤ āĻ•্āώেāϤ্ā§°āĻŦোā§°ā§° āϏৈāϤে 'āĻ•্āϞুāĻŦāĻŽাā§°্āϟ' āύাāĻŽā§° āĻĄাāϟাāĻŦেāϚāϤ āϤাāϞিāĻ•া 'āĻ—্ā§°াāĻšāĻ•' āϏৃāώ্āϟি āϕ⧰āĻ•:) 

Column Name

Data Type

Size

Constraints

Customer ID

INT

 

PRIMARY KEY

Customer Name

VARCHAR

20

NOT NULL

Customer Mobile

VARCHAR

11

NOT NULL

Customer Category

CHAR

1

It is either X, Y or Z


2. Display the structure of the table.

(āϟেāĻŦুāϞ⧰ āĻ—āĻ āύ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।)

Ans: 

3. Insert five records in the table.

(āϟেāĻŦুāϞāϤ āĻĒাঁāϚāϟা ā§°েāϕ⧰্āĻĄ āϏāύ্āύিā§ąিāώ্āϟ āϕ⧰āĻ•।)

Ans: 

4. Display all the records.

(āϏāĻ•āϞো ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।)

Ans: 

5. Display the Customer Name & Customer Mobile.

(āĻ—্ā§°াāĻšāϕ⧰ āύাāĻŽ āφ⧰ু āĻ—্ā§°াāĻšāĻ•āĻŽ'āĻŦাāχāϞ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।)

Ans: 

 6. Display the Customer Name whose Customer Category is 'X'.

 (āĻ—্ā§°াāĻšāϕ⧰ āύাāĻŽ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ• āϝাā§° āĻ—্ā§°াāĻšāĻ•āĻļ্ā§°েāĻŖী 'āĻāĻ•্āϏ'।)

Ans: 

7. Display the Customer ID whose Customer Category is 'Y' OR 'Z'.

(āĻ—্ā§°াāĻšāϕ⧰ āĻļ্ā§°েāĻŖী 'ā§ąাāχ' āĻŦা 'āϜেāĻĄ' āĻšোā§ąা āĻ—্ā§°াāĻšāĻ•āφāχāĻĄি āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।)

Ans: 

8. Display the distinct Customer Category from the table.

(āϤাāϞিāĻ•াā§° āĻĒā§°া āĻĒৃāĻĨāĻ• āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।)

Ans: 

V. SOLUTION


1. The MySQL command to create the database is:

āĻĄাāϟাāĻŦেāχāϚ āϏৃāώ্āϟি āϕ⧰িāĻŦāϞে MySQL āφāĻĻেāĻļāϟো āĻš'āϞ:

CREATE DATABASE Klubmart; 

To use the Database Klubmart, type:


    USE Klubmart;


To create the table 'customer' in the database 'Klubmart":

CREATE TABLE customer

(Customer ID INT PRIMARY KEY,

Customer Name VARCHAR (20) NOT NULL,

Customer Mobile VARCHAR (10) NOT NULL,

Customer Category CHAR);

āĻĄাāϟাāĻŦেāϚ āĻ•্āϞুāĻŦāĻŽাā§°্āϟ āϏৃāώ্āϟি āϕ⧰āĻ•; 


āĻĄাāϟাāĻŦেāϚ āĻ•্āϞুāĻŦāĻŽাā§°্āϟ āĻŦ্āĻ¯ā§ąāĻšাā§° āϕ⧰িāĻŦāϞৈ, āĻĒ্ā§°āĻ•াā§°:


āĻ•্āϞুāĻŦāĻŽাā§°্āϟ āĻŦ্āĻ¯ā§ąāĻšাā§° āϕ⧰āĻ•;


āĻĄাāϟাāĻŦেāϚ 'āĻ•্āϞুāĻŦāĻŽাā§°্āϟ'āϤ āϤাāϞিāĻ•া 'āĻ—্ā§°াāĻšāĻ•' āϏৃāώ্āϟি āϕ⧰িāĻŦāϞৈ:


āϤাāϞিāĻ•া āĻ—্ā§°াāĻšāĻ• āϏৃāώ্āϟি āϕ⧰āĻ•


(āĻ—্ā§°াāĻšāĻ• āφāχāĻĄি āφāχāĻāύāϟি āĻĒ্ā§°াāĻĨāĻŽিāĻ• āĻ•ী,


āĻ—্ā§°াāĻšāϕ⧰ āύাāĻŽ āĻ­াā§°্āϚাā§° (20) āĻŦাāϤিāϞ āύāĻšāϝ়,


āĻ—্ā§°াāĻšāĻ• āĻŽ'āĻŦাāχāϞ āĻ­াā§°্āϚাā§° (10) āĻŦাāϤিāϞ āύāĻšāϝ়,


āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী āϚাā§°);

2. To display the structure of the table type the command: 

(āϟেāĻŦুāϞ⧰ āĻ—āĻ āύ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰িāĻŦāϞৈ āφāĻĻেāĻļ āϞিāĻ–āĻ•:)

    DESCRIBE customer;

(āĻ—্ā§°াāĻšāĻ•āĻ• āĻŦā§°্āĻŖāύা āϕ⧰āĻ•;)

Ans: 

3. To insert the record type the following command:

 (ā§°েāϕ⧰্āĻĄ āϟো āϏুāĻŽুā§ąাāĻŦāϞৈ āύিāĻŽ্āύāϞিāĻ–িāϤ āĻ•āĻŽাāύ্āĻĄāϟো āϟাāχāĻĒ āϕ⧰āĻ•:)

INSERT INTO customer values (1, 'Atul','9435110011", "X"); 

āĻ—্ā§°াāĻšāϕ⧰ āĻŽূāϞ্āϝāϤ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰āĻ• (1, 'āĻ…āϤুāϞ', '9435110011", "āĻāĻ•্āϏ"); 

INSERT INTO customer values (2, 'Ashwini', '9864078011', 'Y');

āĻ—্ā§°াāĻšāϕ⧰ āĻŽূāϞ্āϝāϤ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰āĻ• (2, 'āĻ…āĻļ্āĻŦিāύী', '9864078011', 'ā§ąাāχ');

INSERT INTO customer values (3, 'Anjana, 7086219344", "Z");

āĻ—্ā§°াāĻšāϕ⧰ āĻŽূāϞ্āϝāϤ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰āĻ• (3, 'āĻ…āĻž্āϜāύা, 7086219344", "āϜেāĻĄ");

 INSERT INTO customer values (4, 'Archana', '9435987611", "Y");

āĻ—্ā§°াāĻšāϕ⧰ āĻŽূāϞ্āϝāϤ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰āĻ• (4, 'āĻ…ā§°্āϚāύা', '9435987611", "ā§ąাāχ");

INSERT INTO customer values (5, 'Amresh","9435110011", "X");

āĻ—্ā§°াāĻšāϕ⧰ āĻŽূāϞ্āϝāϤ āĻ…āύ্āϤ⧰্āĻ­ুāĻ•্āϤ āϕ⧰āĻ• (5, 'āĻ…āĻŽā§°েāĻļ", 9435110011", "āĻāĻ•্āϏ");

4. SELECT * FROM customer;

 āĻ—্ā§°াāĻšāϕ⧰ āĻĒā§°া * āĻŦাāĻ›āύি āϕ⧰āĻ•;

5. SELECT Customer Name, Customer Mobile FROM customer;

āĻ—্ā§°াāĻšāϕ⧰ āύাāĻŽ, āĻ—্ā§°াāĻšāϕ⧰ āĻŽ'āĻŦাāχāϞ āĻ—্ā§°াāĻšāϕ⧰ āĻĒā§°া āĻŦাāĻ›āύি āϕ⧰āĻ•;

6. SELECT Customer Name FROM customer WHERE Customer Category = 'X';

āĻ—্ā§°াāĻšāϕ⧰ āĻĒā§°া āĻ—্ā§°াāĻšāϕ⧰ āύাāĻŽ āĻŦাāĻ›āύি āϕ⧰āĻ• āϝ'āϤ āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী = 'āĻāĻ•্āϏ';

7. SELECT Customer ID FROM customer WHERE Customer Category = 'Y' OR

Customer Category = 'Z';

āĻ—্ā§°াāĻšāϕ⧰ āĻĒā§°া āĻ—্ā§°াāĻšāϕ⧰ āφāχāĻĄি āĻŦাāĻ›āύি āϕ⧰āĻ• āϝ'āϤ āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী = 'ā§ąাāχ' āĻŦা


āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী = 'āϜেāĻĄ';

8. SELECT DISTINCT(Customer Category) FROM customer;

āĻ—্ā§°াāĻšāϕ⧰ āĻĒā§°া āĻĒৃāĻĨāĻ• (āĻ—্ā§°াāĻšāĻ• āĻļ্ā§°েāĻŖী) āĻŦাāĻ›āύি āϕ⧰āĻ•;

2. Create a table Worker in a database named Organisation. Enter the records given in the table below.

āϏংāĻ—āĻ āύ āύাāĻŽā§° āĻĄাāϟাāĻŦেāϚ āĻāϟাāϤ āϟেāĻŦুāϞ āϕ⧰্āĻŽী āĻāϟা āϏৃāώ্āϟি āϕ⧰āĻ•। āϤāϞ⧰ āϤাāϞিāĻ•াāϤ āĻĻিāϝ়া ā§°েāϕ⧰্āĻĄāĻŦোā§° āĻĒ্ā§°āĻŦিāώ্āϟ āϕ⧰āĻ•।

Worker _ ID

First _ Name

Last _ Name

Salary

Joining _ Date

Department

001

Rebecca

Doungel

40000

2014-02-20

HR

002

Jahnavi

Borthakur

68000

2014-06-11

Admin

003

Digvijay

Goswami

50000

2014-02-20

HR

004

Krishang

Shandilya

50000

2014-02-20

Admin

005

Jaspal

Bhatti

55000

2014-06-11

Admin

006

Kankana

Devi

20000

2014-06-11

Account

007

Shristi

Goswami

75000

2014-01-20

Account

008

Geeta

sharma

90000

2014-04-11

Admin



Write the commands to do the following:

āύিāĻŽ্āύāϞিāĻ–িāϤāĻŦোā§° āϕ⧰িāĻŦāϞৈ āφāĻĻেāĻļāĻŦোā§° āϞিāĻ–āĻ•:

1. Display Worker ID and Joining Date of Admin Department.

āϕ⧰্āĻŽী āφāχāĻĄি āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ• āφ⧰ু āĻĒ্ā§°āĻļাāϏāĻ• āĻŦিāĻ­াāĻ—ā§° āϝোāĻ—āĻĻাāύ⧰ āϤাā§°িāĻ–।

2. Display records in ascending order of Salary.

āĻĻā§°āĻŽāĻšাā§° āĻŦā§°্āϧিāϤ āĻ•্ā§°āĻŽāϤ ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।

3. Display records having Salary in the range 50000 to 90000.

50000 ā§° āĻĒā§°া 90000 āĻĒā§°িāϏ⧰āϤ āĻĻā§°āĻŽāĻšা āĻĨāĻ•া ā§°েāϕ⧰্āĻĄāĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।

4. Display the record of persons who First Name ends with 'a'. 

āĻĒ্ā§°āĻĨāĻŽ āύাāĻŽ 'āĻ'ā§° āϏৈāϤে āϏāĻŽাāĻĒ্āϤ āĻšোā§ąা āĻŦ্āϝāĻ•্āϤিāϏāĻ•āϞ⧰ ā§°েāϕ⧰্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•। 

5. Display the records of HR and Account Department.

āĻāχāϚāφ⧰ āφ⧰ু āĻāĻ•াāωāĻŖ্āϟ āĻŦিāĻ­াāĻ—ā§° ā§°েāϕ⧰্āĻĄāĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।

6. The worker is given bonus as 1% of the Salary. Display the First Name, Last Name and Bonus.

āĻļ্ā§°āĻŽিāĻ•āϜāύāĻ• āĻĻā§°āĻŽāĻšাā§° 1% āĻšিāϚাāĻĒে āĻŦোāύাāϚ āĻĻিāϝ়া āĻšāϝ়। āĻĒ্ā§°āĻĨāĻŽ āύাāĻŽ, āĻ…āύ্āϤিāĻŽ āύাāĻŽ āφ⧰ু āĻŦোāύাāϚ āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।

7. Display the sum, maximum, minimum and average Salary.

āϝোāĻ—āĻĢāϞ, āϏ⧰্āĻŦাāϧিāĻ•, āύিāĻŽ্āύāϤāĻŽ āφ⧰ু āĻ—āĻĄ় āĻĻā§°āĻŽāĻšা āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ•।

8. Display the count of records where Department = 'HR'.

ā§°েāϕ⧰্āĻĄā§° āĻ—āĻŖāύা āĻĒ্ā§°āĻĻā§°্āĻļāύ āϕ⧰āĻ• āϝ'āϤ āĻŦিāĻ­াāĻ— = 'āĻāχāϚāφ⧰'।

Solution


1. SELECT Worker __ ID, Joining __ Date        FROM Worker WHERE Department = 'Admin'; 

āϚিāϞেāĻ•্āϟ ā§ąā§°্āĻ•াā§° __ āφāχāĻĄি, āϕ⧰্āĻŽীā§° āĻĒā§°া __ āϤাā§°িāĻ–āϤ āϝোāĻ—āĻĻাāύ āϕ⧰া āϝ'āϤ āĻŦিāĻ­াāĻ— = 'āĻĒ্ā§°āĻļাāϏāĻ•'; 

2. SELECT * FROM Worker ORDER BY Salary;

āĻĻā§°āĻŽāĻšাā§° āĻĻ্āĻŦাā§°া āϕ⧰্āĻŽীā§° āĻ…ā§°্āĻĄাā§°ā§° āĻĒā§°া * āĻŦাāĻ›āύি āϕ⧰āĻ•;


3. SELECT * FROM Worker BETWEEN 50000 AND 90000;

50000 āφ⧰ু 90000 ā§° āĻ­িāϤ⧰āϤ āϕ⧰্āĻŽীā§° āĻĒā§°া * āĻŦাāĻ›āύি āϕ⧰āĻ•;

4. SELECT * FROM Worker WHERE First_Name LIKE "%a";

āϕ⧰্āĻŽীā§° āĻĒā§°া āĻŦাāĻ›āύি āϕ⧰āĻ• āϝ'āϤ First_Name "%āĻ•" āĻĒāĻ›āύ্āĻĻ āϕ⧰ে;

5. SELECT * FROM Worker WHERE Department = 'HR' OR Department = 'Account';

 āϕ⧰্āĻŽীā§° āĻĒā§°া āĻŦাāĻ›āύি āϕ⧰āĻ• āϝ'āϤ āĻŦিāĻ­াāĻ— = 'āĻāχāϚāφ⧰' āĻŦা āĻŦিāĻ­াāĻ— = 'āĻāĻ•াāωāĻŖ্āϟ';

6. SELECT First_Name, Last_Name, 0.01 * Salary AS "BONUS" FROM Worker;

First_Name, Last_Name, 0.01 * āϕ⧰্āĻŽীā§° āĻĒā§°া "āĻŦোāύাāϚ" āĻšিāϚাāĻĒে āĻĻā§°āĻŽāĻšা āĻŦাāĻ›āύি āϕ⧰āĻ•;

7. SELECT SUM(Salary), MAX(Salary), MIN(Salary), AVG(Salary);

āϚাāĻŽিāϞ (āĻĻā§°āĻŽāĻšা), āϏ⧰্āĻŦাāϧিāĻ• (āĻĻā§°āĻŽāĻšা), āĻāĻŽāφāχāĻāύ(āĻĻā§°āĻŽāĻšা), āĻ—āĻĄ় (āĻĻā§°āĻŽāĻšা);

8. SELECT COUNT(*) FROM Worker WHERE Department = 'HR';

 āϕ⧰্āĻŽীā§° āĻĒā§°া āĻ—āĻŖāύা(*) āĻŦাāĻ›āύি āϕ⧰āĻ• āϝ'āϤ āĻŦিāĻ­াāĻ— = 'āĻāχāϚāφ⧰';



Type & Assamese Translate: Himashree Bora.

Author-DIKHA BORA


Post ID: DABP002205