Introduction to MySQL Class 11 is a part of CBSE informatics practices class 11 curriculum. In this article, I will provide you a detailed guide about the introduction to MySQL. So let’ start!
Topics Covered
Introduction to MySQL Class 11
If you missed the fundamentals of database follow the below given link:
Now let’s start the article Introduction to MySQL Class 11. There are many DBMS and RDBMS software packages are available. This software provides an interface and the complete database management system solutions to create and maintain databases. For example, MySQL, Oracle, MS SQL Server, PostgreSQL, SQLite etc. So in this article, we will see how to work with an introduction to MySql.
Structured Query Language (SQL)
As you know to work with computers you need commands or script or coding. All the applications required commands to work up on. Similarly, MySQL also requires commands which is considered as query language that allows to use and manage the data from database efficiently. This query language is known as SQL.
Advantages of SQL
SQL offers following advantages:
- As the commands follow simple English language words that are very easy to learn
- SQL is not a case sensitive language, means whether commands are written in capital letters or small letters are similar only
- Retrieve data very easily from the database
- Provides various statements to define the structure of data
- Make Easy data manipulations
- Provides constraints to apply various kind of validations
Installing MySQL
You need to install MySQL to work with MySQL database. In the next section of Introduction to MySQL Class 11 we will discuss installing MySQL. MySQL is an open source software and you can easily download it by following the below give link.
When you open the above link you will get this screen. Click on MySQL Installer for windows.
Now you will get this screen.
After downloading it install an start my sql service from services.msc, if not started. Then click on Start > All Programs > MySQL > MySQL Command Line Client to work on MySQL command. You need to follow some basic rules while writing SQL commands in MySQL.
- The commands are case insensitive, which means that “STUDENTS” and “students” both are similar.
- Every MySQL command statement ends with a semicolon (;)
- You can extend the command to multiple lines by pressing the enter key
- The text values and date values must be enclosed with a single quote (‘), For example, ‘Arvind’, ‘2005-02-56’, etc.
- MySQL follows the ‘YYYY/MM/DD’ format for dates.
The next section of Introduction to MySQL Class 11 will talk about data types.
Data Types in MySQL
MySQL supports following datatypes. The following table shows the numeric data types in MySQL.
Use | Datatype | Storage in Bytes | Range |
For numbers without decimal places | tinyint | 1 | -128 to 127 |
smallint | 2 | -32,768 to 32,767 | |
mediumint | 3 | -83,88,608 to 83,88,607 | |
int | 4 | -2,14,74,83,648 to
| |
bigint | 8 | -263-1 to 264-1 | |
Numbers with point values | Decimal | Maximum 65 digits length | |
Numeric | |||
Float | 4 | ||
Double | 8 |
The next datatype is string data type. The following string datatypes available in MySQL.
- Char
- Varchar
- Binary
- Varbinary
- Blob
- Text
- Enum
- Set
Mostly we will use char or varchar datatypes. Observe the following table and understand the difference.
Value | CHAR(4) | Storage Required | VARCHAR(4) | Storage Required |
---|---|---|---|---|
'' | ' ' | 4 bytes | '' | 1 byte |
'ab' | 'ab ' | 4 bytes | 'ab' | 3 bytes |
'abcd' | 'abcd' | 4 bytes | 'abcd' | 5 bytes |
The next data types is datetime. It is used to store the date values. In the next section of this article Comprehensive notes Introduction to MySQL Class 11 we will discuss about the constraints.
Constraints
Constraints are some set of rules created to apply data validations. It ensures the accuracy and reliability of data. MySQL supports the following constraints:
- Primary Key: As we have discussed the Primary key concept, the primary key is a field or column or attribute which identifies the rows uniquely.
- Foreign Key: It refers to a column which is referenced from the primary key table column.
- Unique Key: It contains the unique records for the column except the primary key
- Default: The default constraint allows to assigns a default value if the value is not inserted
- Not Null: Null refers to a missing or unknown or not applicable value. When this constraint is applied to a column, you cannot insert a value in that column.
That’s all from the Comprehensive notes Introduction to MySQL Class 11. If you have any doubt, feel free to ask in the comment section. Thank you for reading this article.
great work.