Tuesday, 24 November 2015

Database functions

DATABASE:
A database is a collection of information that is organized so that it can easily be accessed, managed, and updated.
Every table that we are creating will be stored in a database.
so to create , update and delete the database a set of keywords are used.
creation of database:
the database can be created with the keyword 'create database'.
syntax: 'create database database_name';
eg: 'create database customer_database;
deletion of database:
similary, a database can be deleted.
syntax: 'delete database database_name';
eg: delete database customer_database;
the above command will delete the database with name 'customer_database'.
TO ALTER THE FIELDS IN A TABLE:
to add a column to the table:
syntax: alter table table_name
add column data_type;
eg: alter table products
add area varchar(120);
and the above code results in:
and similarly the column in a table can be dropped also:
to delete a column from the table:
syntax: alter table table_name
drop column column_name;
eg: alter table products
drop column area;
and the above code brings the following result:
deletion of table:
the deletion of the table can be achieved by delete keyword.
syntax: delete table table_name;
eg: delete table products;
the keyword delete table products, deleted the table in the name of products and hence there is no, no of records in the table.

*****************************************************************************************



No comments:

Post a Comment