Rahul Kumar Saurabh

Showing posts with label SQL Programs. Show all posts
Showing posts with label SQL Programs. Show all posts

sql program to ALTER ( ADD, DROP,MODIFY,RENAME) table

OBJECTIVE:-  Program to ALTER table.

SOFTWARE USED:  Oracle SQL
THEORY:-
ALTER:- It is a DDL command.
The ALTER TABLE statement is used to add, delete, rename or modify columns in an existing table.

SOURCE CODE ( IF INCLUDED )
(1) ADD:-
SYNTAX:-
ALTER  table  table_name
ADD  new_column  Data_type(Size);

QUERY: -To add a column subject  in table stud_itsengg.

OUTPUT:-




(2 ) DROP:-
SYNTAX:-
ALTER  table  table_name
DROP  column  column_name;

QUERY:- To drop the column marks in table stud_itsengg.

OUTPUT:-


(3) MODIFY:-
SYNTAX:-
ALTER  table  table_name
MODIFY  column_name  new_datatype  (New Size);

QUERY:- To modify the column  subject  in table  stud_itsengg.

OUTPUT:-


(4) RENAME:-
SYNTAX:-
ALTER  table  table_name
RENAME column   column_name  to  new_column_name;

QUERY:- To rename the  column  subject  to subject_marks  in table stud_itsengg.
OUTPUT:-

CONCLUSION:-

We learned about writing the program to ALTER table..

sql program to insert and delete value in table.

OBJECTIVE:-  Program to insert and delete value in table.

SOFTWARE USED:  Oracle SQL
THEORY:-

INSERT:- It is a DDL command .The insert statement uses the set clause, which specifies the values of a column. You can use more than one set clause per insert statement, and each set clause can set the values in more than one column. Multiple set clauses are not separated by commas. If you specify an optional list of columns, then you can set a value only for a column that is specified in the list of columns to be inserted .and when character value insert then apply  (' ') example ('value') otherwise not apply.

SOURCE CODE ( IF INCLUDED )
insert into table_name
values(value<,....,value>);                                    

PROCEDURE


OUTPUT:-



DELETE:- It is a DDL command .the delete statement is used to delete rows in a table.

SOURCE CODE ( IF INCLUDED )
delete from table_name
where (some_column=some_value);
                   

PROCEDURE


OUTPUT:-



CONCLUSION:-

We learned about writing the program to insert and delete value in table.




sql program to create table


OBJECTIVE:-  Program to create table.

SOFTWARE USED:  Oracle SQL

THEORY:-
CREATE:- It is a DDL command.
It is used to create table in SQL.

SOURCE CODE ( IF INCLUDED )
Create table table_name
(
Attribute _name1   Data_type (Size),
Attribute _name2   Data_type (Size),
……….
Attribute _name n  Data_type(Size)
);

PROCEDURE



RESULT:-


CONCLUSION:-
We learned about writing the program to create table.