advanced database cs-426 week 1 - introduction. database management system dbms contains information...
TRANSCRIPT
![Page 1: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/1.jpg)
Advanced DatabaseCS-426Week 1 - Introduction
![Page 2: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/2.jpg)
Database Management System DBMS contains information about a particular enterprise
• Collection of interrelated data
• Set of programs to access the data
• An environment that is both convenient and efficient to use
![Page 3: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/3.jpg)
Data-Manipulation LanguageA data-manipulation language (DML) is a language that enables users to access or manipulate data as organized by the appropriate data model. The types of access are:
• Retrieval of information stored in the database
• Insertion of new information into the database
• Deletion of information from the database
• Modification of information stored in the database
Example
select instructor.name
from instructor
where instructor.dept name = ’History’;
![Page 4: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/4.jpg)
Data-Definition Language
• To specify a database schema by a set of definitions expressed by a special language called a data-definition language (DDL). The DDL is also used to specify additional properties of the data.
Example
create table department
(dept name char (20),
building char (15),
budget numeric (12,2));
![Page 5: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/5.jpg)
Relational Databases• A relational database is based on the relational model and
uses a collection of tables to represent both data and the relationships among those data. Each table has multiple columns and each column has a unique name.
Example:
![Page 6: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/6.jpg)
Structured Query Language(SQL) SQL can define the structure of the data, modify data in the database, and specify security constraints.
The SQL language has several parts:
• Data-definition language (DDL). The SQL DDL provides commands for defining relation schemas, deleting relations, and modifying relation schemas.
• Data-manipulation language (DML). The SQL DML provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database.
• Integrity. The SQL DDL includes commands for specifying integrity constraints that the data stored in the database must satisfy. Updates that violate integrity constraints are disallowed.
![Page 7: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/7.jpg)
Structured Query Language(SQL)• View definition. The SQL DDL includes commands for defining views.
• Transaction control. SQL includes commands for specifying the beginning and ending of transactions.
• Embedded SQL and dynamic SQL. Embedded and dynamic SQL define how SQL statements can be embedded within general-purpose programming languages such as C, C++, and Java.
• Authorization. The SQLDDL includes commands for specifying access rights to relations and views.
![Page 8: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/8.jpg)
SQL Basic data Types
The SQL standard supports a variety of built-in types, including:
• char(n): A fixed-length character string with user-specified length n. The full form, character, can be used instead.
• varchar(n): A variable-length character string with user-specified maximum length n. The full form, character varying, is equivalent.
• int: An integer (a finite subset of the integers that ismachine dependent). The full form, integer, is equivalent.
![Page 9: Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated](https://reader035.vdocuments.net/reader035/viewer/2022062517/56649f1f5503460f94c37e84/html5/thumbnails/9.jpg)
SQL Basic data Types• smallint: A small integer (a machine-dependent subset of the integer type).
• numeric(p, d):A fixed-point number with user-specified precision. The number consists of p digits (plus a sign), and d of the p digits are to the right of the decimal point. Thus, numeric(3,1) allows 44.5 to be stored exactly, but neither 444.5 or 0.32 can be stored exactly in a field of this type.
• real, double precision: Floating-point and double-precision floating-point numbers with machine-dependent precision.
• float(n): A floating-point number, with precision of at least n digits.