Here we provide some basic sql queries-DDL,DML
DDL-Data Definition Language
DML-Data Manipulation Language
Data Definition Language:
- Create-Used to create the table.
- Alter-used to change the structure of the table.
- Drop-Used to delete the data and structure of the table.
- Truncate-Used to remove all record from the table, but not the table structure.
- Rename-used to change or rename the table name.
Creating a Table :
create table emp(empno number(4),ename varchar2(25),job varchar2(10),sal number(7),hiredate date);
Altering a Table :
alter table emp add(address varchar2(25));
Dropping a Table :
drop table emp;
Truncate :
truncate table emp;
Renaming a Table :
rename emp to emp;
Data Manipulation Language:
- Select- retrieving data from the a table.
- Insert - insert the data into a table.
- Update - updates the existing data within a table.
- Delete - deletes all records from a table, the space for the records remain same.
Select Query:
select * from emp;
Insert query:
inserti nto emp values (101,'PRASATH','ENGINEER',6000, '01_jan_07' );
Inserting a value by interface:
insert into emp values (&empno,'&ename','&job',&sal,&hiredate);
Enter value for empno: 101
Enter value for ename: Dhinesh
Enter value for job: Manager
Enter value for hiredate:23_apr_09
Enter value for sal: 10000
Update query:
update emp set sal=1000 where sal=500;
Delete query:
delete from emp where empno=7499;