Click if you like the project. Pull Request are highly appreciated.
An index is a database structure that you can use to improve the performance of database activity. A database table can have one or more indexes associated with it. An index is defined by a field expression that you specify when you create the index. Typically, the field expression is a single field name, like EMP_ID.
Note that MySQL supports two different kinds of tables: transaction-safe tables (InnoDB and BDB) and non-transaction-safe tables (HEAP, ISAM, MERGE, and MyISAM). Advantages of transaction-safe tables (TST): Safer.
Relational Database Management System (RDBMS) MySQL is a relational database management system.
- Easy to use. MySQL is easy to use.
- It is secure.
- Client/ Server Architecture.
- Free to download.
- It is scalable.
- Speed.
- High Flexibility.
A JOIN
clause is used to combine rows from two or more tables, based on a related column between them.
Take users
table and orders
table for example.
Users
user_id | name | mobile |
---|---|---|
1 | John | 123 |
2 | Joe | 124 |
Orders
order_id | user_id | total | created_at |
---|---|---|---|
1 | 1 | 500 | 2021-12-19 18:32:00 |
2 | 1 | 800 | 2021-12-03 08:32:00 |
3 | 2 | 50 | 2021-12-13 12:49:00 |
4 | 1 | 80 | 2021-12-15 21:19:00 |
So to get the list of orders with names and mobile nos. for each order, we can join orders
and users
on the basis of user_id
.
select o.*, u.name, u.mobile from ordes o join users u on o.user_id = u.user_id;
select * from employees order by salary limit 2,1;
Both of them are used for string type data. char
has fixed length and if the inserted data is less than the defined length, required no. of blank spaces are added as padding. varchar
has variable length and no padding is used to fill up the left out space. So technically, varchar will save space.