Structured Query Language: What Is SQL?
Structured Query Language: What Is SQL?
A repository of data
Provide the functionality for adding, modifying and querying that data
Different kinds pf database store data in different forms
Data stored in tabular form is a relational database
What is an RDBMS?
CREATE
INSERT
SELECT
UPDATE
INFYTQ
Knowledge- Synthesizing and decision making
Information:-process of data
Data:- Collecting and organizing
Requirement-
.Integrity
-Availability
-Security
-Independent of application
-Concurrent
Data is stored in flat files and can be access using any programming language. The file based
approach suffers following plms
1.Dependency of program on physical structure of data
2.complex process to retrieve data.
3.Loss of data on concurrent access.
4.Inability to give access based on record (Security)
5.Data redundancy
A database is a shared collection of logically related data description of the information needs
of an organization
A database Management System is a software system that enable users to define , create ,
maintain, and control access to the database . Database System typically have high cost and
they require high end and hardware configurations.
An application Program interact with a database by issuing an appropriate request (typically a
SQL Statement)
Relational Model
An attribute is names column of a relation It stores a specific information about an object e.g.
salary.
A tuple is a row in a relation . It represents relationship between attributes that can contain
single value.
Cardinality of relation is number of rows it contains. E.g. Cardinality of relation below is 4.
Degree of relation is the number of attributes it contain e.g. Degree of relation below is 5.
Null represents the value of an attribute that is currently unknown or not applicable.
Domain is the set of allowable values for one or more attributes.
A Collection of relations with distinct relation names is called as Relational model
#Data integrity refers to ,maintaining and assuring the accuracy and consistency of data over its
entire lifecycle . Database Systems ensure data integrity through constraints which are used to
restrict data that can be entered or modification in the database. Database System offers three
types of integrity constraints:
Integrity Types:-
Entity Integrity:- Each table must have a column or a set of columns through which we can
uniquely identify a ROW. These column (s) cannot have empty (NULL) values.
Enforced Through-PRIMARY KEY
Domain Integrity-All attributes in a table must have a defined domain i.e. a finite set of
Values which have to be used. When we assign a data type to a column we limit the values that
it can contain. In addition we can also have value restriction as per business rules e.g. Gender
must be M or F.
Enforced Through: - DATA TYPES, CHECK CONTRAINT
Referential Integrity: - Every values of a column in a table must exist as a value of another
column in a different (or the same) table.
Enforced Through: - FOREIGN KEY
Condidate key:-
A candidate key is minimal set of columns/ attributes that can be used to uniquely identify a
single tuple in a relation. Condidate Keys are determined During database design based on the
underlying business rules of the database. Consider the following relation in context of a
business firm:
When two or more columns together identify the unique row then
it's referred to as Composite Primary Key. The combination of
Name and DateOfBirth if selected as a primary key would be a
composite primary key.
A foreign key is a set of one or more columns in the child table whose values are
required to match with corresponding columns in the parent table. Foreign key
establishes a relationship between these two tables. Foreign key columns on child
tables must be primary key or unique on the parent table. The child table can
contain NULL values.