• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/48

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

48 Cards in this Set

  • Front
  • Back

The most commonly used type of object in a database is the ____.

table.

T/F The structural rules and the constraint rules together restrict the data that can be inserted into the table.

True.

T/F All objects have a name, and all objects are owned by someone.

True

The objects the user owns are their ____.

schema

What query lists the object types that exist in a database?

SQL> select object_type, count (object_type) from dba_objects




This query addresses the view DBA_OBJECTS, which has one row for every object in the database.




Alternate views are USER_OBJECTS, which will show all the objects owned by you, and ALL_OBJECTS, which will show all the objects to which you have been granted access. All users have access to these.

The objects of greatest interest to a SQL programmer are those that contain, or give access to, data. These are (list 5)...

1. Tables


2. Views


3. Synonyms


4. Indexes


5. Sequences

What is a view?

It is a stored SELECT statement that can be addressed as though it were a table. It is nothing more than a SELECT statement but, rather than running the statement itself, the user issues a SELECT statement against the view.

What is a synonym?

It is an alias for a table (or a view). Users can execute SQL statements against the synonym, and the database will map them into statement against the object to which the synonym points.

How do indexes improve access time to rows in tables?

If a query requires only one row, then rather than scanning the entire table to find the row, an index can give a pointer to the row's exact location. Of course, the index itself must be searched, but this is often faster than scanning the table.

What is a sequence?

It is a construct that generates unique numbers. There are many cases where unique numbers are needed. Sequences issue numbers in order, on demand: it is absolutely impossible for the same number to be issued twice.

Who is a user?

Any person who can connect to the database. The user will have a username and a password.

A _____ is a container for the objects owned by a user.

schema

T/F When a user is created, their schema is created too.

True.




Initially, it will be empty.

T/F A schema must have an object in it.

False. Some schemas will always be empty; the user will never create any objects, because they do not need to and (if the user is set up correctly) will not have the necessary privileges anyway.

Schema objects are objects with an _____.

owner.

What is the unique identifier for an object?

The unique identifier for an object of a particular type is not its name-- it is its name, prefixed with the name of the schema to which it belongs.




Ex. Thus the table HR.REGIONS is a table called REGIONS, which is owned by user HR.

A number of users (and their associated schemas) are created automatically at database creation time. Principal among these are which two users?

SYS and SYSTEM.

What does the SYS user own?

The data dictionary (a set of tables that define the database and its contents). SYS also owns several hundred PL/SQL packages: code that is provided for the use of database administrators and developers.

T/F Objects in the SYS schema should never be modified with DML commands.

True.

What would happen if you were to execute DML against the data dictionary tables?

You would run the risk of corrupting the data dictionary, with disastrous results.

You update the data dictionary by running _____ commands.

DDL (Such as create table). This creates a layer of abstraction between you and the data dictionary itself.

What does the SYSTEM schema store?

Various additional objects used for administration and monitoring.

All schema object names must conform to certain rules. What are they?

1. The name may be from 1 to 30 characters long (with the exception of database link names that may be up to 128 characters long)


2. Reserved words (such as SELECT) cannot be used as object names.


3. All names must begin with a letter from "A" through "Z".


4. The characters in a name can only be letters, numbers, an underscore (_), the dollar sign ($), or the hash symbol (#).


5. Lowercase letters will be converted to uppercase.

Object names must be no more than ___ characters. The characters can be ___, ___, ___, ___ or ____.

30


letters, digits, underscore, dollar, hash

T/F Object names are ALWAYS case sensitive.

True.

These two tables different or the same?




SQL> create table lower (c1 date);


Table created.


SQL> create table "lower" (coll varchar2 (2));


Table created.

No. The two tables are completely different






Table_Name


--------------------


lower


LOWER




While it is possible to use lowercase names and nonstandard characters, it is considered bad practice because of the confusion it can cause.

What is a namespace?

A namespace defines a group of object types, within which all names must be uniquely identified, by schema and name. Objects in different namespaces can share the same name.

What object types all share the same namespace?

- Tables


- Views


- Sequences


- Private synonyms

T/F It is impossible to create a view with the same name as a table.

True (at least, it is impossible if they are in the same schema).

T/F An index cannot have the same name as a table.

False. It is possible, even within the same schema.

T/F It is possible to define columns as object.

True.

Each table exists as a definition in the ___ ___.

data dictionary

On creation, the table will have been assigned a limited amount of space, known as an _____, within the database. This may be small, perhaps only a few kilobytes or megabytes. As rows are inserted into the table, this ____ will fill.

Extent, extent.

When an extent is full what will the database do?

It will automatically assign another extent to the table. Even if every row is deleted, the extents remain allocated to the table.

What happens to the extents if the table is dropped or truncated?

They will be freed up and returned to the database for user elsewhere.

T/F When creating tables, each column must be assigned a data type, which determines the nature of the values that can be inserted into the column.

True.

What are the three data types for alphanumeric date?

1. VARCHAR2


2. NVARCHAR2


3. CHAR

What is VARCHAR2?

Variable-length character data, from 1 byte to 4 KB. The data is stored in the database character set.

What is NVARCHAR2?

Like VARCHAR2, but the data is stored in the alternative national language character set, one of the permitted Unicode character set.

What is CHAR?

Fixed-length character data, from 1 byte to 2KB, in the database character set. If the data is not the length of the column, then it will be padded with spaces.

What is the data type for binary data?

RAW

What is RAW?

Variable-length binary data, from 1 byte to 4KB. Unlike the CHAR and VARCHAR2 data types, RAW data is not converted by Oracle Net from the database's character set to the user process's character set on SELECT or the other way on INSERT.

What are the data types for numeric data?

1. NUMBER


2. FLOAT


3. INTEGER

What is the NUMBER datatype?

Numeric data, for which you can specify precision and scale. The precision can range from 1 to 38, the scale can range from -84 to 127.

What is the FLOAT datatype?

This is an ANSI data type, floating-point number with precision of 126 binary ( or 38 decimal). Oracle also provides BINARY_FLOAT and BINARY_DOUBLE as alternatives.

What is the INTEGER datatype?

It is equivalent to NUMBER, with scale zero.

What are the data types for date and time data?

1. DATE


2. TIMESTAMP


3. TIMESTAMP WITH TIMEZONE


4. TIMESTAMP WITH LOCAL TIMEZONE


5. INTERVAL YEAR TO MONTH


6. INTERVAL DAY TO SECOND

What is DATE data type?

This is either length zero, if the column is empty, or 7 bytes. All DATE data includes century, year, month, day, hour, minute, and second. The valid range is from January 1, 4712 BC to December 31, 9999 AD.