SQL Structured Query Language The Structured Query Language
- Slides: 10
SQL- Structured Query Language
The Structured Query Language (SQL) Composed of two categories: • Data Definition n create database create table drop database • Data Manipulation n n used to manipulate the data select delete update
Data Definition n n CREATE TABLE - allows you to create a table definition in a database CREATE DATABASE - allows you to create a database DROP TABLE - removes a table from a database ALTER TABLE - modifies the definition of a table in a database
Example 1: Create Table CREATE TABLE CUSTOMER( LAST_NAME varchar 2(30) not null, STATE_CD varchar(2), SALES number); Example 2: CREATE TABLE PRODUCTS( NAME VARCHAR 2(30) NOT NULL, DESCRIPTION VARCHAR 2(300), PRICE NUMBER(4, 2) ) TABLESPACE PRODUCTSPACE STORAGE(INITIAL 25 K NEXT 25 K MINEXTENTS 1);
Alter Table Add column ALTER TABLE CUSTOMER ADD TAX_EXEMPT_ID VARCHAR 2(20); Drop column ALTER TABLE CUSTOMER DROP COLUMN SALES;
Data Manipulation Language n SELECT - query the database • select * from customer where id > 1001 n INSERT - adds new rows to a table. • Insert into customer values (1009, ‘John Doe’) n DELETE - removes a specified row • delete from customer where amount = 100 n UPDATE - modifies an existing row • update customers set amount = 10 where id > 1003
Select n Get all data from table SELECT * FROM TABLE n Get column Distribute data from table SELECT DISTRIBUTE FROM TABLE n Get all data where…. SELECT * FROM TABLE WHERE NAME IS 'BUTCH GREWE'
Insert n Add following entry to table…order of data fields MUST be the same as when created table INSERT INTO TABLE VALUES ('JAMES BOND', '1 EIFFEL TOWER', 'PARIS', 'FRANCE', 'SPY SOFTWARE')
Delete n Remove entries where…. DELETE FROM TABLE WHERE AGE=10
Describe n Get meta-data DESCRIBE TABLE
- Language
- Introduction to structured query language (sql)
- Kepanjangan sql
- A structured query language – sql operators are
- Sql stands for structured query language
- Update sql command
- Structured query language (sql) is an example of a(n)
- Sql n''
- My structured query language
- Lir
- Iterative query vs recursive query