SQL Intro & DDL
SQL Intro & DDL
RDBMS Software
MySQL,SQL,OracleMangoDB,DB2
Number format :
int(Integer) - Non decimal Numbers.
Float - Decimal Numbers. it supports 6 to 7 decimal digits.
double - Decimal Numbers. it supports upto 14 to 15 decimal digits.
String datatypes:
Char(Character) - Fixed Length
Varchar - Variable length.
DDL Commands :
-create
-alter
-rename
-drop
-truncate
Create Command:
database:
create database databasename;
table:
create table tablename(column1 datatype,column2 datatype,.........);
example:
create table student(student_id int,student_name
varachar(20),student_percentage float);
Alter Command:
1.Adding Column in Existing table.
alter table tablename add column columnname datatype;
Ex:alter table student add column student_age int;
2.drop column.
alter table tablename drop column columnname;
Ex:alter table student drop student_percentage;
3.Modify Column Datatype.
alter table tablename modify column columnname datatype;
Ex:alter table student modify column student_id varchar(20);
4.rename column.
alter table tablename rename column oldcolumnname to newcolumnname;
Ex: alter table student rename column student_name to stu_name;
Rename Command:
rename table oldtablename to newtablename;
Ex: rename table student to student_details;