0% found this document useful (0 votes)
4 views3 pages

DBMS Chapter-8

DBMS notes

Uploaded by

nainularab999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

DBMS Chapter-8

DBMS notes

Uploaded by

nainularab999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

If you are using an enterprise RDBMS, you must be authenticated by the

RDBMS before you can start creating tables.

Authentication is the process the DBMS uses to verify that only


registered users access the database.

a schema is a logical group of database objects—such as tables and


indexes—that are related to each other. Usually, the schema belongs to a
single user or application. A single database can hold multiple schemas
that belong to different users or applications. Schemas are useful in that
they group tables by owner (or function) and enforce a first level of
security by allowing each user to see only the tables that belong to that
user.

ANSI SQL standards define a command to create a database schema:

CREATE SCHEMA AUTHORIZATION {creator};

In RDBMS, when a user is created, the DBMS automatically assigns a


schema to that user.

When the DBMS is used, the CREATE SCHEMA AUTHORIZATION command


must be issued by the user who owns the schema. That is, if you log on as
JONES, you can only use CREATE SCHEMA AUTHORIZATION JONES.

For most RDBMSs, the CREATE SCHEMA AUTHORIZATION command is


optional.

Even though zip codes contain all digits, they must be defined as
character data because some zip codes begin with the digit zero (0), and a
numeric data type would cause the leading zero to be dropped.

At first glance, it might seem logical to select a numeric data type for
V_AREACODE because it contains only digits. However, adding and
subtracting area codes does not yield meaningful results. Therefore,
selecting a character data type is more appropriate.

FK = Foreign key

PK = Primary key

CHAR = Fixed-length character data, 1 to 255 characters

VARCHA = Variable-length character data, 1 to 2,000 characters. VARCHAR is automati


R converted to VARCHAR2 in Oracle.
DECIMA = Numeric data. DECIMAL(9,2) is used to specify numbers that have two decim
L and are up to nine digits long, including the decimal places. Some RDBMSs pe
of a MONEY or a CURRENCY data type.

NUMERI = Numeric data. DBMSs that do not support the NUMBER data type typically u
C NUMERIC instead.

INT = Integer values only. INT is automatically converted to NUMBER in Oracle.

SMALLIN = Small integer values only. SMALLINT is automatically converted to NUMBER


T

DATE formats vary. Commonly accepted formats are DD-MON-YYYY, DD-


MON-YY, MM/DD/YYYY, and MM/DD/YY

In a 1:M relationship, you must always create the table for the “1” side
first.

 If your RDBMS does not support the VARCHAR2 and FCHAR format,
use CHAR.

 Oracle accepts the VARCHAR data type and automatically converts it to


VARCHAR2.
 If your RDBMS does not support SINT or SMALLINT, use INTEGER or
INT. If INTEGER is not supported, use NUMBER (Oracle or Access) or
NUMERIC (MS SQL Server or MySQL).
 If you use Access, you can use the NUMBER data type, but you cannot
use the number delimiters at the SQL level. For example, using
NUMBER(8,2) to indicate numbers with up to eight digits with two
digits to the right of the decimal place is fine in Oracle, but you cannot
use it in Access—you must use NUMBER without the delimiters.
 If your RDBMS does not support primary and foreign key designations
or the UNIQUE specification, delete them from the SQL code shown
here.
 If you use the PRIMARY KEY designation in Oracle, you do not need the
NOT NULL and UNIQUE specifications.
 The ON UPDATE CASCADE clause is part of the ANSI standard, but it
may not be supported by your RDBMS. In that case, delete the ON
UPDATE CASCADE clause.
The primary key attributes contain both a NOT NULL and UNIQUE
specification, which enforce the entity integrity requirements.

The order of the primary key components is important because the


indexing starts with the first mentioned attribute, then proceeds with the
next attribute, and so on
The ON UPDATE CASCADE specification ensures that if you make a change
in any VENDOR’s V_CODE that change is automatically applied to all
foreign key references throughout the system to ensure that referential
integrity is maintained.

An RDBMS automatically enforces referential integrity for foreign keys.

Column name PER-NUM might generate an error message, but PER_NUM is


acceptable.

Entity integrity is enforced automatically when the primary key is


specified in the CREATE TABLE command sequence.

Primary keys should not support ON UPDATE CASCADE, to overcome


referential integrity.

 MySQL requires the InnoDB storage engine to enforce referential


integrity.

 MS Access, SQL Server, MySQL, and Oracle support ON DELETE


CASCADE.

 MS Access, SQL Server, and MySQL support ON UPDATE CASCADE.

 Oracle does not support ON UPDATE CASCADE.

 Oracle and MySQL support SET NULL.

 MS Access and SQL Server do not support SET NULL.

 Refer to your product manuals for additional information on


referential constraints.

You might also like