Documente Academic
Documente Profesional
Documente Cultură
Introduction to SQL
Dr. Vandana Janeja
Information System Dept
Objectives
Chapter 7
Roadmap
An overview of SQL
How to login in to Oracle using
SQL*Plus
How to create tables and defining
column data types
How to insert and delete rows
How to write a query without
conditions
Chapter 7
Database activity
physical database design and
database implementation
Chapter 7
Implementation
Implementation
Maintenance
SQL Overview
Chapter 7
JAVA: JDBC
Internet: use VBScript and Microsoft Active
Server Pages
Chapter 7
Chapter 7
Oracle SQL*Plus
Open browser, go to
http://oracle92.is.umbc.edu:7778/isqlplus
Chapter 7
SQL Environment
Schema
Chapter 7
SQL Environment
Catalog
User_tables:
10
Chapter 7
11
Chapter 7
12
Create Table
CREATE TABLE table-name
(column1-name data-type,
last-column-name data-type)
E.g.,
create table dept (
did int,
dname varchar(30),
primary key (did)
);
Chapter 7
13
Create Table
SQL is not case sensitive
Last column has no comma
Semi colon represents end of each
statement
(can run several statements in one
execution)
Comments:
-- comments on the same line
/* comments that span multiple lines */
Chapter 7
14
Drop A Table
Drop table dept
A good habit to drop a table
before create a table
Chapter 7
15
String types
Chapter 7
16
Chapter 7
17
Numeric types
Chapter 7
18
Chapter 7
19
Chapter 7
20
Chapter 7
21
Chapter 7
22
Insert:
Insert
Template:
insert into table-name values(values for all
columns, separated by comma)
Values in the column order
Dont forget values keyword
Dont forget how to represent strings and
date E.g.,
insert into dept values (1,'IT');
insert into dept values (2, 'HR');
Chapter 7
23
Insert
24
SQL Environment
Delete:
Chapter 7
25
select
Chapter 7
26
select
Grammar:
select * or column-name, , columnname
from table-name
[where condition]
Chapter 7
27
select
Describe table-name
E.g., describe emp;
It returns column names, column data
types
Chapter 7
28