Page 47 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 47

Database Management Systems/Managing Database




                    Notes          string representing that color’s name; allowable operations include addition and subtraction,
                                   but not multiplication.
                                   A data type can also be thought of as a constraint placed upon the interpretation of data in a type
                                   system, describing representation, interpretation and structure of values or objects stored in
                                   computer memory. The type system uses data type information to check of computer programs
                                   that access or manipulate the data.
                                   Here are the most common data types:

                                    char(size)      Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
                                    Varchar(size)    Variable-length character string. Max size is specified in parenthesis.
                                    number(size)    Number value with a max number of column digits specified in parenthesis.
                                    Date            Date value
                                    number(size,d)    Number value with a maximum number of digits of "size" total, with a
                                                    maximum number of "d" digits to the right of the decimal.


                                   3.4 Schema Definition

                                   It is the overall structure is called a database schema. Database schema is usually  graphical
                                   presentation of the whole database. Tables are connected with external keys and key colums.
                                   When accessing data from several tables, database schema will be needed in order to find
                                   joining data elements and in complex cases to find proper intermediate tables. Some database
                                   products use the schema to join the tables automatically.
                                   Database system has several schemas according to the level of abstraction. The physical schema
                                   describes the database design at physical level. The logical schema describes the database design
                                   at logical level. A database can also have sub-schemas (view level) that describes different views
                                   of database.

                                   3.5 Basic Structure of SQL Queries

                                   The general format of any SQL query is as follows:
                                          SELECT   [DISTINCT] select-list
                                          FROM     from-list
                                          WHERE    qualification
                                   1.  Select Clause: SELECT is a command from DML language which is used to select specific
                                       columns of the tables. Every SQL query starts with SELECT keyword and is followed by
                                       the list of the columns that forms the resulting relation.
                                   2.  From: This clause specifies the names of the tables from which data is to be retrieved.
                                       FROM is followed by a set of range values which uniquely identifies a table, when its
                                       name occurs more than once.
                                   3.  Where: WHERE keyword is used to specify a condition. All the tuples which satisfies the
                                       condition are selected.
                                   4.  Distinct: The use of this keyword is to prevent the duplication of rows, when this keyword
                                       is used all the tuples of the table are unique. There is no redundant data. The use of this
                                       keyword is optional.

                                   5.  Select-List: Collection of all the column names that user want in the new relation.




          40                                LOVELY PROFESSIONAL UNIVERSITY
   42   43   44   45   46   47   48   49   50   51   52