You are on page 1of 29

show databases;

command is used for previously crated


database in Mysql

use database_name;
command is used for open previously
created database

show tables ;
command is used for open previously
created tables from previously created
database

drop table table_name;


command is used for remove table from
Mysql

create database database_name;


command is used to create database

000000000

describe table_name; command is used to


show field structure of any table

desc table_name; command is used to show


field structure of any table

alter table table_name rename to


new_table_name; command is used to
change table name
alter table table_name modify field_name
datatype(size); command is used to modify
field datatypeor field size

alter table table_name add field_name


datatype(size); command is used to add new
field in table

alter table table_name change field_name


new field_name datatype(size);
command is used to change field name

alter table table_name drop field_name;


command is used for remove field
drop table table_name; command is used
for remove table

drop database database_name;


command is used for remove database
INSERT INTO TABLE METHODS
insert into table_name values(record);

 Insert command is used to insert


new record .

 There are two method apply with


insert command .
 Update command is used to
update record of any
column(Field).
EXAMPLES OF AGGREGATION FUNCTIONS
………………………………………………………………………………………………………………………………………………………………………….
WHAT IS CONSTRAINT?
CONSTRAINT IS THE CONDITION OF CHECK APPLICABLE ON A FIELD OR SET OF
FIELDS .

TYPES OF CONSTRAINT-:
THE TWO BASIC TYPES OF CONSTRAINTS ARE COLUMN CONSTRAINTS AND TABLE
CONSTRAINTS THE DIFFERENCE BETWEEN THE TWO IS THAT COLUMN
CONSTRAINTS APPLY ONLY TO INDIVIDUAL COLUMS, WHERE AS TABLE
CONSTRAINTS APPLY TO GROUP OF ONE OR MORE COLUMS .

DIFFERENT CONSTRIENTS-:
THESE CONSTRAINTS ENSURE DATABSE INTEGRITY, THUS ARE SOMETIMES
CALLED DATABASES INTEGRITY CONSTRAINTS A FEW OF THEM ARE

1. UNIQUE
2. NOT NULL
3. PRIMARY KEY
4. CHECK
5. DEFAULT
6. REFERENCES
TABLE -: ITEMS
FIELD TYPE CONSTRAINT
Item_code Integer(5) Primary key
Item_name Varchar(15) unique
costperitem Decimal(5,2) Not null
qty Integer(4) Check(qty>0)
Dateofpurchase date
warranty integer Default value 1 year
operational Integer(2)

EXAMPLES OF COLUMN CONSTRAINT-:


Table constraint

You might also like