SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql

Join Roy Library Telegram Groups

Hello Viewers Today’s We are going to Share With You, The Complete Syllabus of SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Solutions in English in This Page. Are you a Student of (Secondary Education Board of Assam). SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Notes. Which you Can Download PDF SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Question Answer for free using direct Download Link Given Below in This Post.

SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql

We have Shared in This Post, SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Textbook PDF Download for Free with you. SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Solutions PDF. I Hope, you Liked The information About The SEBA Class 10 Computer Science Chapter 3 Database Part – II Mysql Book PDF. If you liked Class 10 Computer Science Notes Then Please Do Share this Post With your Friends as Well.

Database Part – II Mysql

TEXTUAL QUESTIONS AND ANSWERS

EXERCISE

I. MULTIPLE CHOICE QUESTIONS:

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

(a) ALTRE 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. The wildcard character allows finding a match for any string of any length, including zero length.

(a) *

(b) %

(c) #

Ans. (a) %

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, ______________.

Ans. My.

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

Ans. cardinality.

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

Ans. columns.

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

Ans. Reserved.

5. A MySQL statement is terminated by a ________________.

Ans. semi-colon.

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

Ans. single.

III. ANSWER THE FOLLOWING QUESTIONS:

1. Who were the developers of MySQL?

Ans. The developers of the MySQL platform were Michael Widenius (Monty), David Axmark and Allan Larsson.

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

Ans. MySQL is becoming so popular because –

  • MySQL is released under an open-source license.
  • MySQL works on many operating system and with many languages including PHP, PERL, C, C ++ etc.
  • MySQL works very quickly and supports large databases.

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

Ans. Constraints are the rules that help ensure the validity of the data while entering data in a table. In other words, MySQL constraints are used to specify rules for the data in a table.

The constraints in MySQL are PRIMARY KEY, NOT NULL, FOREIGN KEY, UNIQUE etc.

4. Give example of DML commands.

Ans. Data Manipulation Language (DML) commands are used to modify the database. Some of the DML commands are —

INSERT, UPDATE, DELETE etc.

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

Ans. The data can be determined by the —

  • Number of bytes it takes for storage.
  • Kind of value it represents.

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

Ans. To display complete information about the table structure, the query is –

DESCRIBE <TABLE NAME>;

Or

DESC <TABLE NAME>;

For example, if the table name is student, then the query is–

DESCRIBE student;

Or

DESC student;

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

Ans. To display all the records in a table, the query is –

SELECT * FROM <TABLE NAME>;

For example, if the table name is student, then the query is —

SELECT FROM student;

8. List the Arithmetic Operators used in MySQL.

Ans. The Arithmetic Operators used in MySQL are —

OperatorMeaningExample
+AdditionA + B
SubtractionA – B
/DivisionA / B
*MultiplicationA * B
%Modulus or remainderA % B

9. List the Relational Operators used in MySQL.

Ans. Relational operators compare two expressions or values and return a Boolearn result. The relational operators used in MySQL are –

OperatorMeaningExample
=Equal toA = B
<> Or !=Not equal toA != B
<Less thanA > B
>Greater thanA <B
<=Less than or equal toA <= B
>=Greater than or equal toA >= B

10. Differentiate between COUNT(*) and COUNT.

Ans. The COUNT (*) returns all rows whether column contains null value or not while COUNT returns the number of rows except null rows.

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

Ans. The rules for naming a table in MySQL are –

  • A table can have maximum of 30 characters.
  • A table name should begin with an alphabet.
  • The special character (_) underscore is allowed.
  • Reserved words are not allowed.

12. Explain the five categories of SQL commands.

Ans. SQL Commands are divided into five broad categories – DDL, DML, DCL, TCL, and DQL.

(a) Data Definition Language (DDL) – The Data Definition Language is made up of SQL commands that can be used to design the database structure.

Some commands come under this category are –

CREATE, ALTER, DROP, TRUNCATE

(b) Data Manipulation Language (DML) – The SQL commands that deal with manipulating data in a database are classified as DML (Data Manipulation Language), which covers the majority of SQL statements. Some commands come under this category are–

INSERT, UPDATE, DELETE

(c) Data Control Language (DCL) – DCL (Data Controlling Language) is a query language that allows users to retrieve and edit data held in databases. Some commands come under this category are–

GRANT, REVOKE

(d) Transaction Control Language (TCL) – Transaction Control Language (TCL) instructions are used in the database to manage transactions. This command is used to handle the DML statements’ modifications.

Some commands come under this category are –

COMMIT, ROLLBACL, SAVEPOINT

(e) Data Query Language (DQL) – Data Query Language (DOL) is used to fetch the data from the database.

Some commands come under this category are –

SELECT, SHOW, HELP

S.L No.CONTENTS
Chapter 1Introduction To Computer Network
Chapter 2Html5 And Css3
Chapter 3Database Part – II Mysql
Chapter 4Introduction To Loops
Chapter 5Nested Loops In C
Chapter 6Arrays In C
Chapter 7Functions In C
Chapter 8Pointers In C
Chapter 9Structure In C
Chapter 10An Introduction To Object Oriented Programming
Chapter 11Case Studies
ADDITIONAL QUESTIONS AND ANSWERS

1. What is a database?

Ans. A database is an organized collection of structured information or data stored electronically in a computer system.

2. What is DBMS?

Ans. A database management system (or DBMS) is a computerized data-keeping system. It manages incoming data, organizes it, and provides ways for the data to be modified or extracted by users or other programs. Some DBMS examples include MySQL, Microsoft Access, SQL Server, Oracle, RDBMS, FoxPro etc.

3. What is MySQL?

Ans. MySQL, is an open-source Database Management System (DBMS) for managing and organizing the data in a tabular format. These data can be manipulated using MySQL programming language.

4. What does SQL in MySQL stand for?

Ans. The SQL in MySQL stands for Structured Query Language.

5. What does a MySQL database contain?

Ans. A MySQL database contains one or more tables, each of which contains records or rows. Within these rows are various columns or fields that contain the data itself.

6. Why MySQL is used?

Ans. 

  • Open –source software
  • Flexible structure
  • High performance
  • Security and storage management
  • Works on many operating system

7. What are MySQL Database Queries?

Ans. A query is a specific request or a question. One can query a database for specific information and have a record returned.

8. What is the difference between database and tables?

Ans. There is a major difference between a database and a table. The differences are as follows:

  • Tables are a way to represent the division of data in a database while the database is a collection of tables and data.
  • Tables are used to group the data in relation to each other and create a dataset. This dataset will be used in the database. The data stored in the table in any form is a part of the database, but the reverse is not true.
  • A database is a collection of organized data and features used to access them, whereas the table is a collection of rows and columns used to store the data.

9. How do you create a database in MySQL?

Ans. To create a new database name “school”, the command is CREATE DATABASE school;

10. What are the basic SQL commands?

Ans. There are five types of SQL commands:

  • Data Definition Language (DDL)
  • Data Manipulation Language (DML)
  • Data Control Language (DCL)
  • Transaction Control Language (TCL)
  • Data Query Language (DQL)

11. Differentiate between DML and DDL.

Ans. The SQL DML (Data Manipulation Language) is used to put values and manipulate them in tables and other database objects and DDL (Data Definition Language) is used to create tables and other database objects.

12. How do you create a table name “academic” in MySQL?

Ans. To create the table using MySQL, the command is –

CREATE TABLE academic (

name VARCHAR (30),

class CHAR (5),

UT1 INT);

13. How do you insert data into MySQL?

Ans. The INSERT INTO statement is used to add new records to a MySQL table:

Syntax:

INSERT INTO table_name

VALUES (value1, value2, value3);

14. What is the command to view the MySQL version?

Ans. The command to know about the MySQL version is –

SELECT VERSION ();

15. What is the command to view all databases in MySQL?

Ans. To view the existing databases on the MySQL server, the query is –

SHOW DATABASES;

16. What are the various data types supported by MySQL?

Ans. The various data types supported by MySQL are —

Data TypeMeaning
CHAR (size)A FIXED length string (can contain letters, numbers, and special characters). The size parameter specifies the column length in characters – can be from 0 to 255. Default is 1
VARCHAR (size)A VARIABLE length string (can contain letters, numbers, and special characters). The size parameter specifies the maximum column length in characters-can be from 0 to 65535
TEXT (size)Holds a string with a maximum length of 65,535 bytes
SMALLINT (size)A small integer. The size parameter specifies the maximum display width (which is 255)
INT (size)A medium integer. The size parameter specifies the maximum display width (which is 255)
FLOAT (size, d)A floating point numbers. The total number of digits is specified in size. The number of digits after the decimal point is specified in the d parameter.
DOUBLE (size, d)A normal-size floating point number. The total number of digits is specified in size. The number of digits after the decimal point is specified in the d parameter.
DATEA date. Format: YYYY-MM-DD.
DATETIMEA date and time combination. Format: YYYY-MM-DD hh:mm:ss.
TIMEA time. Format: hh:mm:ss.
YEARA year in four-digit format.

17. Differentiate between FLOAT and DOUBLE.

Ans. 

  • Floating point numbers are stored in FLOAT with eight place accuracy and it has four bytes.
  • Floating point numbers are stored in DOUBLE with accuracy of 18 places and it has eight bytes.

18. Differentiate between CHAR and VARCHAR.

Ans. Following are the differences between CHAR and VARCHAR:

  • CHAR and VARCHAR types differ in storage and retrieval.
  • CHAR column length is fixed to the length that is declared while creating table. The length value ranges from 1 and 255
  • When CHAR values are stored then they are right padded using spaces to specific length. Trailing spaces are removed when CHAR values are retrieved.

19. Explain the different types of constraints.

Ans. MySQL CONSTRAINT is used to define rules to allow or restrict what values can be stored in columns. The purpose of inducing constraints is to enforce the integrity of a database. MySQL CONSTRAINT is declared at the time of creating a table.

The different types of constraints are —

ConstraintsDescription
NOT NULLIn MySQL NOT NULL constraint allows to specify that a column cannot contain any NULL value.
PRIMARY KEYA PRIMARY KEY constraint for a table enforces the table to accept unique data for a specific column and this constraint creates a unique index for accessing the table faster.
UNIQUEThe UNIQUE constraint in MySQL does not allow to insert a duplicate value in a column.
FOREIGN KEYA FOREIGN KEY in MySQL creates a link between two tables by one specific column of both tables.

20. What is the command to display the structure of a table?

Ans. To display the structure of a table, the command is —

DESCRIBE table_name

Or

DESC table_name

21. How do we change the structure of a table?

Ans. The ALTER TABLE command is used to modify the structure of an existing table.

22. What are the functions we can do with ALTER TABLE?

Ans. With ALTER TABLE command we can —

  • Add or delete column.
  • Change the data type of the existing columns.
  • Rename columns.
  • Delete table.
  • Add/delete PRIMARY KEY and NOT NULL constraints.

23. How do we create new columns in an existing table?

Ans. The syntax for creating a new column in a table is —

ALTER TABLE table_name

ADD (new_column_name data_type(size), new_column_name data_type(size),…);

24. How do we create new columns to the table at a specific location?

Ans. To add a column to the column at a specific location in a table structure, the syntax is —

ALTER TABLE table_name

ADD (new_column_name data_type(size) AFTER old_column_name;

25. How do we modify a column in an existing table?

Ans. The syntax to modify a column in an existing table is —

ALTER TABLE table_name

MODIFY (column_name new_data_type (size));

26. How do we rename a column in an existing table?

Ans. ALTER TABLE table_name

CHANGE (old_column_name new_column_name data_type (size));

27. How to delete a column in an existing table?

Ans. To delete a column in an existing table, we use the DROP command. The syntax for this command is –

ALTER TABLE table_name

DROP (column_name);

28. How to delete an existing table?

Ans. Sometimes, we are required to permanently delete a table along with its structure. The syntax for this command is—

DROP TABLE table_name;

29. What is SELECT statement in MySQL?

Ans. The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set.

30. What are the ways to retrieve data from SELECT statement in MySQL?

Ans. There are three ways to retrieve data from a table:

  • Selected columns and all rows.
  • Selected rows and all columns.
  • Selected columns and selected rows.

31. What is DROP TABLE statement in MySQL?

Ans. We can delete a table in MySQL using the Drop Table statement. This statement removes the complete data of a table, including structure and definition from the database permanently.

Therefore, it is required to be careful while deleting a table. After using the statement, we cannot recover the table in MySQL.

32. How to drop the primary key in MySQL?

Ans. MySQL primary key is a single or combination of the field used to identify each record in a table uniquely. A primary key column cannot be null or empty.

We can remove or delete a primary key from the table using the ALTER TABLE statement.

The following syntax is used to drop the primary key:

ALTER TABLE table_name

DROP PRIMARY KEY;

33. What is DELETE in MySQL?

Ans. The DELETE command is used to delete data from a table. It only deletes the rows of data from the table.

34. What is SELECT * FROM in MySQL?

Ans. SELECT is the keyword that starts the query and instructs MySQL on what task it must perform. FROM is a mandatory clause that specifies the table or tables to select the data from.

35. How do we write a SELECT statement in MySQL?

Ans. The syntax is:

SELECT column1, column2 FROM table_name;

36. What is the use of WHERE clause?

Ans. The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition.

37. Explain the syntax of SELECT statement using WHERE clause?

Ans. SELECT * FROM table_name WHERE conditions;

Explanation:

  • SELECT is the keyword that starts the query and instructs MySQL on what task it must perform.
  • FROM is a mandatory clause that specifies the table or tables to select the data from.
  • WHERE is an optional condition, though it is very frequent in MySQL SELECT statements – it specifies the criteria to define the necessary data and return it.

38. What does the DISTINCT clause do?

Ans. The SQL DISTINCT clause is used to remove duplicates from the result set of a SELECT statement.

Syntax:

SELECT DISTINCT column_name FROM table_name;

39. What is LIKE operator in MySQL?

Ans. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.

40. What do you mean by % and _ in the LIKE statement?

Ans. % corresponds to 0 or more characters, _ is exactly one character in the LIKE statement.

41. What is the use of BETWEEN clause in MySQL?

Ans. The MySQL BETWEEN Condition is used to retrieve values within a range in a SELECT statement. In other words, the BETWEEN clause is used to search the data within the range (specified lower and upper limit).

Example:

SELECT * FROM student WHERE marks BETWEEN 40 and 50;

It will display all the records having marks in the range 40 to 50.

42. What are SQL operators?

Ans. SQL operator is a special word or character used to perform tasks. These tasks can be anything from complex comparisons, to basic arithmetic operations.

43. What are AND, OR and NOT operators?

Ans. AND, OR and NOT are logical operators. AND, OR, NOT operators are basically used with WHERE clause in order to retrieve data from table by filtering with some conditions.

44. What is the meaning of AND operator?

Ans. AND operator requires all the conditions be true for inclusion in the result.

Example:

SELECT * FROM table_name WHERE marks> = 40 AND marks< = 50;

Will display all the records that satisfy both the conditions given in the WHERE clause.

45. What is the meaning of OR operator?

Ans. OR operator requires any one of the conditions be true for inclusion in the result.

Example:

SELECT * FROM table_name WHERE section = ‘A’ OR section = ‘B’;

Will display all the records that satisfy any of the conditions given in the WHERE clause.

46. What is the meaning of NOT operator?

Ans. NOT operator displays only those records that do not satisfy the given condition.

Example:

SELECT * FROM table_name WHERE NOT (section = ‘A’);

Will display all the records that do not satisfy the condition given in the WHERE clause.

47. What is sorting?

Ans. Sorting is used for arranging data in a large database. The data can be sorted either in ascending or descending order.

48. How sorting is done in MySQL?

Ans. Sorting can be done in MySQL using the ORDER BY clause.

49. What is the use of ORDER BY clause in MySQL?

Ans. The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

50. What is ASC and DESC?

Ans. ASC: to sort the data in ascending order. DESC: to sort the data in descending order.

51. What is the syntax to sort data in MySQL?

Ans. The syntax is –

SELECT * FROM table_name ORDER BY column_name sort_order;

Example:

SELECT * FROM student ORDER BY s_name DESC;

Will display the records from the student table in descending order of s_name.

52. What is UPDATE command in MySQL?

Ans. UPDATE MySQL command is used to modify rows in a table. The update command can be used to update a single field or multiple fields at the same time.

The UPDATE statement is used with the SET and WHERE clauses. The SET clause is used to change the values of the specified column. We can update single or multiple columns at a time.

53. What is the syntax of UPDATE command?

Ans. 

UPDATE table_name

SET column_name = new-value

WHERE Clause;

Explanation:

ParameterDescription
table_nameIt is the name of a table in which we want to perform updation.
column_nameIt is the name of a column in which we want to perform updation with the new value using the SET clause.
WHERE ClauseIt is optional. It is used to specify the row name in which we are going to perform updation. If we omit this clause, MySQL updates all rows.

Example:

UPDATE student

SET marks = 45

WHERE roll_no=5;

Meaning:

Will update the record of marks as 45 whose roll_no is 5.

54. What are group functions?

Ans. Group functions are mathematical functions to operate on sets of rows to give one result per set.

55. What is the purpose of group functions?

Ans. The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. i.e if a particular column has same values in different rows then it will arrange these rows in a group.

56. What are the different aggregate functions with example?

Ans.

FunctionsMeaning
SUM()Returns the sum of values of specified columns / expressions.
MAX()Returns the maximum value of a set of values of specified columns / expressions
MIN()Returns the minimum value of a set of values of specified columns / expressions
AVG()Returns the average of values of specified columns / expressions.
COUNT()Returns the number of values in specified columns / expressions
COUNT(*)Returns the number of rows in the table.

Example:

SELECT SUM (Marks), AVG (Marks), MAXv(Marks), MIN (Marks) FROM student;

Meaning:

The result will show the sum, average, maximum and minimum values of the Marks of the student table.

Leave a Reply

error: Content is protected !!
Scroll to Top