Posts

Showing posts with the label SISTEM BASIS DATA

DDL Part II

Image
Outline • Overview of Database Transactions • Commit • Savepoint • Rollback Database Transactions A database transaction consists of one of the following: • DML statements which constitute one consistent change to the data • One DDL statement • One DCL statement Database Transactions • Begin when the first DML SQL statement is executed • End with one of the following events:      – A COMMIT or ROLLBACK statement is issued      – A DDL or DCL statement executes (automatic commit)      – The system crashes Advantages of COMMIT and ROLLBACK Statements With COMMIT and ROLLBACK statements, you can: • Ensure data consistency • Preview data changes before making changes permanent • Group logically related operations Controling Transactions Diagram Rolling Back Changes to a Savepoint • You can create a marker in the current transaction by using the SAVEPOINT statement which divide...

Tutorial DDL SQL

Image
DDL Part 1 Objectives After completing this lesson, you should be able to do the following: • Create tables • Alter table definitions • Drop, rename, and truncate tables *Lesson Aim In this lesson, you learn about tables, the main database objects, and their relationships to each other. You also learn how to create , alter, and drop tables.* Outline • Naming Rules • DDL Syntax – Creating Table – Altering Table – Dropping Table Naming Rules Table names and column names: • Must begin with a letter • Must be 1–30 characters long • Must contain only A–Z, a–z, 0–9, _, $, and # • Must not duplicate the name of another object owned by the same user The CREATE TABLE Statement You must have: – CREATE TABLE privilege – A storage area Ex. CREATE TABLE [ schema .] table ( column datatype [DEFAULT expr ][, ...]); The CREATE TABLE Statement – schema is the same as the owner’s name – table is the name of the table – D...