DBMS L6

0.0(0)
studied byStudied by 2 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/39

flashcard set

Earn XP

Description and Tags

Using DDL Statements to Create and Manage Tables

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

40 Terms

1
New cards

Database Objects

  • table

  • view

  • sequence

  • index

  • synonym

2
New cards

Table

Basic unit of storage; composed of rows

3
New cards

View

Logically represents subsets of data from one or more tables

4
New cards

Sequence

Generates numeric values

5
New cards

Index

Improves the performance of some queries

6
New cards

Synonym

Gives alternative name to an object

7
New cards

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

  • Must not be an Oracle server-reserved word

8
New cards

CREATE TABLE Statement

You specify:

  • Table name

  • Column name, column data type, and column size

<p>You specify: </p><ul><li><p>Table name </p></li><li><p>Column name, column data type, and column size</p></li></ul><p></p>
9
New cards

DEFAULT Option

  • Specify a default value for a column during an insert

  • Literal values, expressions, or SQL functions are legal values

  • Another column’s name or a pseudocolumn are illegal values

  • The default data type must match the column data type

<ul><li><p>Specify a default value for a column during an insert </p></li><li><p>Literal values, expressions, or SQL functions are legal values </p></li><li><p>Another column’s name or a pseudocolumn are illegal values </p></li><li><p>The default data type must match the column data type</p></li></ul><p></p>
10
New cards

Creating Tables

knowt flashcard image
11
New cards

VARCHAR2(size)

variable-length character data

12
New cards

CHAR(size)

fixed length character data

13
New cards

NUMBER(p, s)

variable length numeric data

14
New cards

DATE

date and time values

15
New cards

LONG

variable length character data (up to 2 gb)

16
New cards

CLOB

character data (up to 4 gb)

17
New cards

RAW and LONG RAW

raw binary data

18
New cards

BLOB

binary data (up to 4 gb)

19
New cards

BFILE

binary data stored in an external file (up to 4 gb)

20
New cards

ROWID

a base-64 number system representing the unique address of a row in its table

21
New cards

TIMESTAMP

date with functional seconds

22
New cards

INTERVAL YEAR TO MONTH

stored as an interval of years and months

23
New cards

INTERVAL DAY TO SECOND

stored as an interval of days, hours, minutes, and seconds

24
New cards

Constraints

  • enforce rules at the table level

  • prevent the deletion of a table if there are dependencies

25
New cards

Constraint Types

  • NOT NULL

  • UNIQUE

  • PRIMARY KEY

  • FOREIGN KEY

  • CHECK

26
New cards

Constraint Guidelines

  • You can name a constraint, or the Oracle server generates a name by using the SYS_Cn format

  • Create a constraint at either of the following times:

    • At the same time as the creation of the table

    • After the creation of the table

  • Define a constraint at the column or table level.

  • View a constraint in the data dictionary.

27
New cards

constraint syntax

knowt flashcard image
28
New cards

Column-level constraint syntax

knowt flashcard image
29
New cards

Table-level constraint syntax

knowt flashcard image
30
New cards

Example of a column-level constraint

knowt flashcard image
31
New cards

Example of a table-level constraint

knowt flashcard image
32
New cards

NOT NULL Constraint

Ensures that null values are not permitted for the column

33
New cards

UNIQUE Constraint

Defined at either the table level or the column level

34
New cards

PRIMARY KEY Constraint

knowt flashcard image
35
New cards

FOREIGN KEY Constraint

knowt flashcard image
36
New cards

FOREIGN KEY

Defines the column in the child table at the table-constraint level

37
New cards

REFERENCES

Identifies the table and column in the parent table

38
New cards

ON DELETE CASCADE

Deletes the dependent rows in the child table when a row in the parent table is deleted

39
New cards

ON DELETE SET NULL

Converts dependent foreign key values to null

40
New cards

CHECK Constraint

Defines a condition that each row must satisfy

Explore top flashcards

DECA Marketing
Updated 1080d ago
flashcards Flashcards (409)
1.1
Updated 115d ago
flashcards Flashcards (29)
Criminal Law
Updated 490d ago
flashcards Flashcards (36)
unit 6 gradesavers
Updated 1045d ago
flashcards Flashcards (58)
Ecology
Updated 1039d ago
flashcards Flashcards (124)
DECA Marketing
Updated 1080d ago
flashcards Flashcards (409)
1.1
Updated 115d ago
flashcards Flashcards (29)
Criminal Law
Updated 490d ago
flashcards Flashcards (36)
unit 6 gradesavers
Updated 1045d ago
flashcards Flashcards (58)
Ecology
Updated 1039d ago
flashcards Flashcards (124)