* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Database Languages
Concurrency control wikipedia , lookup
Microsoft Access wikipedia , lookup
Oracle Database wikipedia , lookup
Ingres (database) wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Functional Database Model wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Clusterpoint wikipedia , lookup
A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database Languages are used to create and maintain database on computer. There are large numbers of database languages like Oracle, MySQL, MS Access, dBase, FoxPro etc. SQL statements commonly used in Oracle and MS Access can be categorized as Data Definition Language (DDL) Data Control Language (DCL) Data Manipulation Language (DML). It is a language that allows the users to define data and their relationship to other types of data. It is mainly used to create files, databases, data dictionary and tables within databases. It is also used to specify the structure of each table, set of associated values with each attribute, integrity constraints, security and authorization information for each table and physical storage structure of each table on disk. Create Alter Drop Syntax: Create table table_name(attribute1 data type,….attribute n data type); Example: Create table student(id number, name varchar2(10),emailid varchar2(10)); Syntax: Alter table table_name add(attribute datatype); Example: Alter table student add(phno number); Syntax: Alter table table_name drop(attribute); Example: Alter table student drop(phno); Syntax: Drop table_name; Example: Drop student; Create Select Update Insert Delete It is a language that provides a set of operations to support the basic data manipulation operations on the data held in the databases. It allows users to insert, update, delete and retrieve data from the database. The part of DML that involves data retrieval is called a query language. SQL > Create Table Cust(cname varchar2(15),cid number(5),caddr char(10), caccno number(5),cacctype varchar2(10),cbalance float, Primarykey(cid),unique(cname),unique(caccno),check(cbalance>= 1000)); SQL> desc cust; Name Null? Type ----------------------------------------- -------- ---------------------------CNAME VARCHAR2(15) CID NOT NULL NUMBER(5) CADDR CHAR(10) CACCNO NUMBER(5) CACCTYPE VARCHAR2(10) CBALANCE FLOAT(126) SQL> select * from cust; CNAME CID CADDR CACCNO CACCTYPE CBALANCE --------------- ---------- ---------- ---------- ---------- ----------------------------------Anusha 1 Chennai 1001 savings 15000 Shriram 2 Pondy 1002 savings 25000 Chamundi 3 Salem 1003 fd 36200 Madhan 4 Salem 1004 checkings 5000 Subha 5 Trichy 1005 checkings 10000 Jayashree 6 Pondy 1006 fd 15000 Sridharan 7 Kanchi 1007 fd 22000 7 rows selected. SQL>update cust set caccno=1111 where cname='Chamundi'; 1 row updated SQL> select * from cust; CNAME CID CADDR CACCNO CACCTYPE CBALANCE --------------- ---------- ---------- ---------- ---------- -------------------------------------Anusha 1 Chennai 1001 savings 15000 Shriram 2 Pondy 1002 savings 25000 Chamundi 3 Salem 1111 fd 36200 Madhan 4 Salem 1004 checkings 5000 4 rows selected. SQL> insert into cust values('Anitha',01,'Chennai',1001,'savings',150 00); 1 row created. SQL> insert into cust values('Shriram',02,'Pondy',1002,'savings',250 00); 1 row created. SQL>delete from cust where cacctype='fd'; 3 row deleted SQL> select * from cust; CNAME CID CADDR CACCNO CACCTYPE CBALANCE --------------- ---------- ---------- ---------- ---------- -----------------------------------Anusha 1 Chennai 1001 savings 15000 Shriram 2 Pondy 1002 savings 25000 Madhan 4 Salem 1004 checkings 5000 Subha 5 Trichy 1005 checkings 10000 4 rows selected. Grant Revoke DCL statements control access to data and the database using statements such as GRANT and REVOKE. A privilege can either be granted to a User with the help of GRANT statement. The privileges assigned can be SELECT, ALTER, DELETE, EXECUTE, INSERT, INDEX etc. In addition to granting of privileges, you can also revoke (taken back) it by using REVOKE command. Grant < database_priv [database_priv…..] > to <user_name> identified by <password> [,<password…..]; Grant <object_priv> | All on <object> to <user | public> [ With Grant Option ]; Revoke <database_priv> from <user [, user ] >; Revoke <object_priv> on <object> from < user | public >; In practice, the data definition and data manipulation languages are not two separate languages. Instead they simply form parts of a single database language such as Structured Query Language (SQL). SQL represents combination of DDL and DML, as well as statements for constraints specification and schema evaluation.