You are on page 1of 2

Update table_name

Set column1_name = value1, column2_name = value 2


Where condition (in for two rows)

Where clause
Select column1, column2, column,,,,
From table_name
Where condition;

Regular expression
Select column1, column2, columnN,…..
From table_name
Where column_name REGEXP pattern

Create table with primary key


Create table table_name
(
Column1 datatype not null auto_increment,
Column2 datatype not null,
columnN… datatype not null,
Primary key (column name)
);

Alter table table_name


Add primary key (column_name);

Foreign Key in table


Create table table_name
Column1 datatype,
Column2 datatype,
columnN datatype,
Primary key (column_Name),
Foreign key (column_Name) References Table_Name (table_column));

Select with order


Select column_name, column_name, columnN…
From table_name
Order by colum_name.. ASC|DESC

Select data with distinct


Select DISTINCT column_name, Column_Name….
From table_name;

Limit and offset


Select column_Name,….
From table_name
Where condition
Limit number;

Select column_name
From table_name
Where condition
Limit offset, number;
Select with like operator
Select from column_name…..
From table_name
Where column_name like pattern; ……. not like pattern;

You might also like