Mysql
Mysql
It is stands for the structured Query language, it is used to interact with the database for
inserting, retriving , updating the data from the database. Basically it used to manuplate the
database.
MySQL:
It is the relational database management system (RDBMS), A software that enables users
to create, manage, and manipulate databases.
SQL is a language used to communicate with databases, while MySQL is a specific software
system used to implement and manage databases.
1|Page
2|Page
Creating the table:
3|Page
Inserting into table:
4|Page
It select entities in column with value is null
WILDCARDS
• A wildcard character is used to substitute one or more characters in a string.
• Wildcard characters are used with the SQL LIKE operator.
• The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
ORDER BY:
DISTINCT:
5|Page
GROUP BY: this keyword is always used with the aggregate function
in SQL, we use the GROUP BY clause to group rows based on the value of columns.
Note: The GROUP BY clause is used in conjunction with aggregate functions such as MIN() and
MAX(), SUM() and AVG(), COUNT(), etc.
6|Page
Having:
The SQL HAVING clause is used if we need to filter the result set based on aggregate functions such
-- select customers with the same first name based on their age count
SELECT COUNT(age) AS Count, first_name
FROM Customers
GROUP BY first_name
HAVING COUNT(age) > 1;
by first_name
SQL Constraints
In a database table, we can add rules to a column known as constraints. These rules control the data that
For example, if a column has NOT NULL constraint, it means the column cannot store NULL values.
8|Page
9|Page
10 | P a g e
SQL ALTER TABLE Statement
In SQL, the ALTER TABLE command is used to modify the structure of an existing table like adding,
Here, the SQL command adds a column named phone to the Customers table.
11 | P a g e
DML: data modification language
DML (Data Manipulation Language) are SQL commands focused on handling data within the database,
including most SQL statements.
12 | P a g e
REPLACE:
this keyword if the entity is already is present then it modify it if it is not present then it insert it.
SQL REPLACE()
The REPLACE() function is a string function in SQL to replace all occurrences of a specified string with
Here, the result set of this query replaces all occurrences of John with Jonathan in
the first_name column of the Customers table.
JOINs:
13 | P a g e
14 | P a g e
15 | P a g e
16 | P a g e
17 | P a g e
18 | P a g e
19 | P a g e
20 | P a g e
Union :
Intersection :
MINUS :
21 | P a g e
22 | P a g e
23 | P a g e
24 | P a g e
25 | P a g e