Professional Documents
Culture Documents
+--------------------+
| Database |
+--------------------+
| information_schema |
| college |
| company |
| employees |
| mysql |
| satudent |
| student |
| studfeesmang |
| test |
1. Adding a record in database
Insert:- In this command we add a record in the database.
Syntax:- insert table<table name>
Example:- mysql> create database college;
Query OK, 1 row affected (0.00 sec)
mysql>
where columnname=expression;
+---------+-----------+--------+
+---------+-----------+--------+
+---------+-----------+--------+
3 rows in set (0.00 sec)
+---------+-----------+--------+
+---------+-----------+--------+
+---------+-----------+--------+
mysql>
mysql>
mysql> update student
-> set stuclass=12
-> where stuname='manu';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql>
4. Generate queries
Select command: The sql select into statement is used to select data from a
SQL database table and to insert it to a different table at the same time.
+---------+-----------+--------+
+---------+-----------+--------+
+---------+-----------+--------+
We may need to modify the way in which data is displayed and want to perform
calculations. This can be done with arithmetic expressions using +, -, *, /.
E.g.
+------+---------+---------+--------+-------------+
+------+---------+---------+--------+-------------+
+------+---------+---------+--------+-------------+
4 rows in set (0.02 sec)
Specify the alias after the column in the SELECT list using a space as a separator.
Thus, Column Alias renames column headings and is useful with calculation.
E.g.
+------+---------+---------+--------+---------+
+------+---------+---------+--------+---------+
+------+---------+---------+--------+---------+
LOGICAL OPERATORS
E.g.
+------+-------+---------+--------+
+------+-------+---------+--------+
E.g.
+------+-------+---------+--------+
+------+-------+---------+--------+
+------+-------+---------+--------+
E.g.
+------+---------+---------+--------+
+------+---------+---------+--------+
SPECIAL OPERATORS
There are certain special operators used with WHERE clause. These are:
E.g.
+------+---------+---------+--------+
+------+---------+---------+--------+
+------+---------+---------+--------+
+------+-------+---------+--------+
+------+-------+---------+--------+
+------+-------+---------+--------+
LIKE OPERATOR:In certain cases you may not always know the exact value to
search for. You can select rows that match a character pattern by using LIKE
operator. This operator is used with CHAR datatype.
Symbol Description
% Represents any sequence of zero or more characters
_ Represents any single character
E.g.
+------+-------+---------+--------+
+------+-------+---------+--------+