itec 313 database programming
DESCRIPTION
ITEC 313 Database Programming. Bits of SQL. Objectives. Review Select Statement Creating tables Learn how to create and use Sequence View Learn how to Grant/Revoke priveleges. Syntax of SELECT. SELECT [ALL | DISTINCT] select-list FROM table-reference-list - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/1.jpg)
![Page 2: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/2.jpg)
Review › Select Statement› Creating tables
Learn how to create and use› Sequence› View
Learn how to Grant/Revoke priveleges
![Page 3: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/3.jpg)
SELECT [ALL | DISTINCT] select-list FROM table-reference-list [WHERE search-condition] [GROUP BY column-name [, column-name]... ] [HAVING search-condition] [[UNION | UNION ALL |INTERSECT | MINUS] select-statement ]... [ORDER BY {unsigned integer | column-name} [ASC|DESC]]
![Page 4: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/4.jpg)
select-list :› columns, expressions, fixed values.› Include aliases
table-reference-list› Tables, views, subqueries (inline view)
search-condition› Conditions involving columns, fixed values,
subqueries
![Page 5: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/5.jpg)
CREATE TABLE table-name(Column-name data-type
[column-constraints] [DEFAULT default-value]
{, Column-name data-type [column-constraints] [DEFAULT default-value]
}[table-constraint {, table-constraint}])
![Page 6: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/6.jpg)
ALTER TABLE table-nameADD column-declaration [ column-
constraints]OrALTER TABLE table-nameADD table-constraintsOrALTER TABLE table nameMODIFY column
![Page 7: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/7.jpg)
autonumber field › independent of a column
An object in Oracle that is used to generate a number sequence
Useful for creating a unique number to act as a primary key
![Page 8: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/8.jpg)
CREATE SEQUENCE sequence_name MINVALUE value MAXVALUE value START WITH value INCREMENT BY value CACHE value;
![Page 9: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/9.jpg)
Representation of an sql statement› Only the code to create the view is stored
in the data dictionary NOT the actual data Used for
› Improving efficiency› Improving Security› Hiding details/columns from end users
![Page 10: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/10.jpg)
CREATE VIEW view-nameASSelect-statement
![Page 11: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/11.jpg)
Privileges are of two types :› SYSTEM PRIVILEGES › OBJECT PRIVILEGES
GRANT : allows users access to your objects.› INSERT, DELETE, UPDATE, SELECT, EXECUTE
privileges may be granted to other users REVOKE : removes existing privileges on
an object from other users.
![Page 12: ITEC 313 Database Programming](https://reader036.vdocuments.mx/reader036/viewer/2022081722/56815bba550346895dc9b57a/html5/thumbnails/12.jpg)
GRANT INSERT, DELETE, UPDATE, SELECT, EXECUTE|ALL on object-name TO user-list|ROLE|PUBLIC;
REVOKE INSERT, DELETE, UPDATE, SELECT, EXECUTE | ALL on object-name FROM user-list|ROLE|PUBLIC;
ROLE: contaimns groups of users determined by the DBA
PUBLIC : A system ROLE that contains all users of the database