Wednesday, 23 June 2021

CLASS 11 CS CHAPTER 16

 

CLASS -11  COMPUTER  SCIENCE

               CHAPTER- 16  RELATIONAL  DATABASES


🔔To download textbook pdf click on the ''DOWNLOAD'' button below -



NOTES FOR COMPLETE UNDERSTANDING -


  • A Database System is generally a record storing system.
  • Collected form of data is referred as database. 
  • “Database" is actually a collection of interrelated data so that it can be used by various applications. 
  • Some of the Popular database softwares are-                                                                                          • MySQL (open Source)                                                                                                  • ORACLE Database                                                                                                        • MS SQL Server                                                                                                              • SQLite (open Source)                                                                                                    • MariaDB                                                                                                                        • PostgreSQL (open Source)

  • Aim of DBMS:
  • Database Management System (DBMS) is a software , it's purpose is to store , maintain and use databases. 
  • Its prime purpose is to perform operations on databases and to provide data when required. 
  • DBMS reduces Data Redundancy. 
  • It improves data security. 
  • It stores data n organized and Integrated form. 
  • Data remains error free. 
  • Data is available as and when required. 
  • Database follows a standard.

  • Relational Database Model :– 
  • In Relational Data model, data remains in the form of tables. 
  • A table is a combination of rows and columns which is also known as Relation . 
  •  In a table, a row shows relationship between values. A table is a collection of this relationship. 
  • Byte: A group of 8 bits used to store a character is known as byte. 
  • Data Item: Smallest unit of data. 
  • Record: It is a complete information made of data item. 
  • Table: A table is a collection of logical records.

  • Relational Model Terminology :
  • Relational Model was given by E. F. Codd of IBM. 
  • Terminology of Relation Model is:-
  • Relation: Basically a relation is a table. Its a collection of data in rows and columns. A relation has following features-                                                                                    • In a table, data in one column should be of same data type. Different columns can have data of different data types.                                                                               •  A column in a row can not have multiple values.                                                       • In a relation, each row is distinct. Any two rows cannot have exactly same data.                                                                                                                                           • There is no specific order of rows in a relation.                                                         • In a Relation i.e. table, there is no specific order of columns.

  • Domain: It is the collection/pool of values for a column is known as Domain. 
  • Tuple : rows of a table are known as tuples. 
  • Attribute : columns of a table are known as attributes. 
  • Degree : In a relation, number of attributes or columns is its Degree. 
  • Cardinality : In a relation, number of tuples or rows is its Cardinality.
  • Views – A View is a Virtual table which is based on some or specific data of a table
  • Keys – Some attributes has some properties because of that those attributes are known as keys. 
  • Primary Key : It is a attribute which is used to uniquely identify records of a relation & can be used to establish relationship with other relation. It is a mixture of unique & not null constraint. Generally all master tables have primary keys. 
  • Candidate Key : Its a group of attributes which have the properties to be selected as a primary key i.e. These attributes shows their capability to be a Primary Key. 
  • Alternate Key : A candidate key which is not a primary key is known as alternate key. 
  • Foreign Key : In a table, an attribute which is derived from primary key of some other table is known as foreign key in present table.

  • Referential Integrity: Referential integrity is a system of rules which is used by a DBMS to ensure that there is a valid relationship between related tables or not. 
  • Referential integrity is possible only when following conditions gets completed- 
  1. Primary key should have unique index.
  2. Related fields should have same datatype. 
  3. All tables should be of same database. 
  4. Primary key of Master table should have a reference with foreign key of transaction table. 
  5. Entry of that record in transaction table is not possible whose foreign key value does not exist in primary key of master table. 
  6. Deletion of that record from primary key table is not possible which has a related record in foreign key table. 
  7. Change in related records of primary key is not possible.

  • MySQL:
  • MySQL is an open source Relational Database Management System (RDBMS) which makes use of SQL (Structured Query Language). 
  •  It can be downloaded from www.mysql.org. 
  • In MySQL, information is stored in the form of tables.
  • A MySQL database can have multiple tables and thousands of records simultaneously.
  • It is a better option to store fast, reliable and big amount of data. 
  • MySQL was developed by MySQL AB company which is now a part of Sun Microsystems. 
  • SERVER : which responds to the requests of clients. 
  • CLIENTS : these are the programs which are attached to database server and send requests to server.
  • MySQL Features :                                                                                                                               – Fast Speed                                              – Easy to use.                                                 – Free of cost.                                            – Support of SQL.                                         – Portability.                                              – Various Data types.                                   – Secure.                                                                                                                           – Can handle large data (Scalability and limits).                                                         – Connectivity : uses various protocols to get connected with clients.                       – Localization : server can send error messages to clients in different languages.                                                                                                                                               – Clients and Tools. It provides various client and utility programs.

  • SQL:
  •  Structured Query Language (SQL) is used to access any database.
  • SQL stores the commands that are to be used in databases which are generally accepted by all RDBMS. 
  • SQL is a language which provides interface to create relational database and to operate upon them. 
  • Various versions of SQL are available. First version was developed in 1970 by San Jose Research Laboratory of IBM. 
  • In 1992, 2003, 2008 some updates were added.
  • SQL is being used by beginners and skilled users.

  • Processing Capabilities of SQL :
  1. Data Definition Language (DDL) 
  2. Interactive Data Manipulation Language(DML) 
  3. Embedded Data Manipulation Language: these are developed to be used in some programming languages 
  4. View Definition 
  5. Authorization 
  6. Integrity 
  7. Transaction Control

  • Data Definition Language (DDL) :
  • Command under this category are used to create or modify scheme of database. It is used to create data dictionary. 
  • Data Dictionary is a kind of metadata means Data about Data. A standard DDL should have following functions- 
  1. It should identify the types of data division. 
  2. It should give a unique name of each data item. 
  3. It should specify the proper data type. 
  4. It may define the length of data items.
  5. It may define the range of values of Data items. 
  6. It may specify means of checking for errors.
  7. It may specify privacy locks for preventing unauthorized reading or modification of the data.
  • DDL Commands Following commands are under this category- 
  • Create, alter and drop schema Objects:
  1. Create table
  2. create view
  3. create database
  • Alter Table
  • Drop Table 
  • Drop View 
  • Create Index 
  • Alter Index
  • Grant and Revoke privileges and rolls
  1. Grant
  2. Revoke
  • Maintenance Commands
  1. Analyze Table 
  2. Check Table 
  3. Restore Table etc.
  • DML Commands:
  • DML (Data Manipulation Language) is a kind of language used to access data, insert data and delete data from a data model. 
  • Data manipulation means- 
  1. Accessing the stored data from a Database.
  2. Insertion of new information into the Database. 
  3. Deletion of information from the Database. 
  4. modification of information in the Database. 
  • DMLs are basically of two types- 
  1. Procedural : specifies what data is needed and how to get it. 
  2. Non- Procedural: specifies what data is needed without specifying how to get it.
  • TCL Commands :
  • A transaction is one complete unit of work for ex- withdrawl of 2000 Rs/- from a bank Account. 
  • Following commands are used to successfully complete a transaction.
  • COMMIT : it makes all the changes permanent. 
  • ROLLBACK : undoes all the changes. 
  • SAVEPOINT : it marks a point upto which all earlier statements have been successfully completed. 
  • SET TRANSACTION : it establishes properties for the current transactions.
         
          🔔MORE MATERIALS TO BE UPLOADED STAY TUNED🔔

WHY Software Developer ?