Download presentation
Presentation is loading. Please wait.
1
CS SQL
2
The Structured Query Language (SQL)
Composed of two categories: Data Definition create database create table drop database Data Manipulation used to manipulate the data select delete update
3
Data Definition 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
4
Create Table Example 1: Example 2: CREATE TABLE CUSTOMER(
LAST_NAME varchar2(30) not null, STATE_CD varchar(2), SALES number); Example 2: CREATE TABLE PRODUCTS( NAME VARCHAR2(30) NOT NULL, DESCRIPTION VARCHAR2(300), PRICE NUMBER(4,2) ) TABLESPACE PRODUCTSPACE STORAGE(INITIAL 25K NEXT 25K MINEXTENTS 1);
5
Alter Table Add column ALTER TABLE CUSTOMER ADD TAX_EXEMPT_ID VARCHAR2(20); Drop column ALTER TABLE CUSTOMER DROP COLUMN SALES;
6
Data Manipulation Language
SELECT - query the database select * from customer where id > 1001 INSERT - adds new rows to a table. Insert into customer values (1009, ‘John Doe’) DELETE - removes a specified row delete from customer where amount = 100 UPDATE - modifies an existing row update customers set amount = 10 where id > 1003
7
Select Get all data from table Get column Distribute data from table
SELECT * FROM TABLE Get column Distribute data from table SELECT DISTRIBUTE FROM TABLE Get all data where…. SELECT * FROM TABLE WHERE NAME IS 'BUTCH GREWE'
8
Insert 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')
9
Delete Remove entries where…. DELETE FROM TABLE WHERE AGE=10
10
Describe Get meta-data DESCRIBE TABLE
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.