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.
(āĻŽেāĻāĻāύ⧰ āĻাঁāĻĨāύি āĻĻেāĻুā§ąাāĻŦāϞৈ, āĻāĻাā§°āĻো āĻš'āϞ āĻāĻāĻিāĻāĻāϞ-āϤ āĻŦিā§ąā§°āĻŖ āĻŦা āĻĄিāĻāĻāĻāĻি āĻšৈāĻে āĻāĻ āĻŦিāĻŦৃāϤি āϝি āϤাāϞিāĻাāĻāύ⧰ āĻাঁāĻĨāύি āĻĻেāĻুā§ąাāϝ়। āĻāϝ়াāϤ āύিā§°্āϧাā§°িāϤ āϤাāϞিāĻাā§° āĻĒ্ā§°āϤিāĻো āϏ্āϤāĻŽ্āĻāϤ āϏāĻāϞো āϤāĻĨ্āϝ āĻĨাāĻে, āϝেāύে āϏ্āϤāĻŽ্āĻā§° āύাāĻŽ, āϏ্āϤāĻŽ্āĻā§° āĻĒ্ā§°āĻাā§°, āĻĄিāĻĢāϞ্āĻ āĻŽাāύ, āϝāĻĻি āĻ āĻļূāύ্āϝ āĻšāϝ় āĻŦা āĻŦাāϤিāϞ āύāĻšāϝ় āĻāϤ্āϝাāĻĻি।)
āĻāĻা āĻেāĻŦুāϞāϤ āϏāĻāϞো ā§°েāĻā§°্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āĻā§°িāĻŦāϞৈ āĻĒ্ā§°āĻļ্āύāĻো āĻি?
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.
(āĻেāĻŦāϞāĻāĻāύāϤ āϏāĻāϞো ā§°েāĻā§°্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āĻā§°িāĻŦāϞৈ āϤাāϞিāĻাā§° āĻাঁāĻĨāύিā§° āĻāĻাā§°, āĻŦā§°্āĻāĻŦা āĻĄিāĻāĻāĻāĻি-ā§° āĻŦā§°্āĻŖāύা āĻšৈāĻে āĻāĻ āĻŦিāĻŦৃāϤি āϝি āϤাāϞিāĻাāĻāύ⧰ āĻাঁāĻĨāύি āĻĻেāĻুā§ąাāϝ়। āĻāϝ়াāϤ āύিā§°্āϧাā§°িāϤ āϤাāϞিāĻাā§° āĻĒ্ā§°āϤিāĻো āϏ্āϤāĻŽ্āĻāϤ āϏāĻāϞো āϤāĻĨ্āϝ āĻĨাāĻে, āϝেāύে āϏ্āϤāĻŽ্āĻā§° āύাāĻŽ, āϏ্āϤāĻŽ্āĻā§° āĻĒ্ā§°āĻাā§°, āĻĄিāĻĢāϞ্āĻ āĻŽাāύ, āϝāĻĻি āĻ āĻļূāύ্āϝ āĻšāϝ় āĻŦা āĻŦাāϤিāϞ āύāĻā§°ে āĻāϤ্āϝাāĻĻি।)
āĻāĻা āĻেāĻŦুāϞāϤ āϏāĻāϞো ā§°েāĻā§°্āĻĄ āĻĒ্ā§°āĻĻā§°্āĻļāύ āĻā§°িāĻŦāϞৈ āĻĒ্ā§°āĻļ্āύāĻো āĻি?
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
