Oracle_1
Oracle_1
Oracle_1
Database:
RDBMS:
Relational Database management system is a database with relational model.
Almost all the RDBMS use SQL for querying.
A relational database refers to a database that stores data in a structured format
using rows and columns.
The values within each table are related to each other. Tables may also be related to other tables.
The relational structure makes it possible to run queries across multiple tables at once
Ex: Oracle, MySQL, Micro soft sql server etc…
Syntax: create table table_name (column1 dataype (size), column2 datatype (size)
….column(size))
2) ALTER: Alter is used to add a column, modify a column, rename a column and drop a column.
Syntax: alter table table_name rename column old column name to new column name;
When we use truncate only data of a table get deleted, the structure will remain.
DIRECT METHOD: In this method we provide values directly by addressing the table.
Ex: insert into emp values ( ‘alex’, 2000, 20 ) >>> we need to provide value for all the columns when we
use this method.
Note: To insert the data for specific columns we use following method.
REFERENCE METHOD: In this method we can insert multiple rows of data at a time. We provide values
through prompt
Syntax: insert into table_name values (&col1,&col2,…);
Note1: Oracle doesn’t make any permanent changes to any DML operations until we commit it.
Note2: When we are character data type we must specify the value in single quotes.
2) UPDATE:
Update is used to update the existed data of the table based on where condition.
Ex: update emp set sal=2000 where empid = 123;
Note:We should use ‘is’ to compare null in where clause.
Ex: update emp set sal = 2000 where empid is null;
3) DELETE:
Delete is used to delete the rows of a table.
Ex: delete from emp; >> To delete table content.
delete from emp where ename = ‘alex’ >> to delete particular records.
DCL statements are the one of the sql statement types which enforces database security.
It is used to grant defined role and access privileges to the users.
GRANT :
A DBA or user can grant access permission to other users on database using grant option.
When a user is newly created in the data base DBA should grant below privileges to user in order to
connect to the database.
When user or owner of a table wants to give select permission to another user the following can be
used.
Privileges are the permission name which is granted to the user likeselect, insert, update, delete,
execute.
REVOKE:
The revoke command is used to take back the existing privilege from a user.
It only DBA or a user with admin option can revoke system privilege.