You are on page 1of 27
What is Database The database is a collection of inter-related data which is used to retrieve, insert and delete the data efficiently. It is also used to organize the data in the form of a table, schema, views, and reports, etc. For example: The college Database organizes the data about the admin, staff, students and faculty etc. Database Management System oO ° Database management system is a software which is used to manage the database. For example: MySQL, Oracle, etc are a very popular commercial database which is used in different applications. DBMS provides an interface to perform various operations like database creation, storing data in it, updating data, creating a table in the database and a lot more. It provides protection and security to the database. In the case of multiple users, it also maintains data consistency. Characteristics of DBMS © Ituses a digital repository established on a server to store and manage the information. © It can provide a clear and logical view of the process that manipulates data. ° DBMS contains automatic backup and recovery procedures. © It contains ACID properties which maintain data in a healthy state in case of failure. o |t can reduce the complex relationship between data. © It is used to support manipulation and processing of data. © Itis used to provide security of data. © It can view the database from different viewpoints according to the requirements of the user. ___ Advantages of DBMS o Controls database redundancy: It can control data redundancy because it stores all the data in one single database fite and that recorded data is placed in the database. © Data sharing: In DBMS, the authorized users of an organization can share the data among multiple users. o Easily Maintenance: It can be easily maintainable due to the centralized nature of the database system. o Reduce time: It reduces development time and maintenance need. o Backup: It provides backup and recovery subsystems which create automatic backup of data from hardware and software failures and restores the data if required. © Backup: It provides backup and recovery subsystems which create automatic backup of data from hardware and software failures and restores the data if required. °o multiple user interface: It provides different types of user interfaces like graphical user interfaces, application program interfaces Disadvantages of DBMS o Cost of Hardware and Software: It requires a high speed of data processor and large memory size to run DBMS software. © Size: It occupies a large space of disks and large memory to run them efficiently. © Complexity: Database system creates additional complexity and requirements. © Higher impact of failure: Failure is highly impacted the database because in most of the organization, all the data stored in a single database and if the database is damaged due to electric failure or database corruption then the data may be lost forever. DBMS 3-tier Architecture DBMS 3-tier architecture divides the com- plete system into three inter-related but in- dependent modules as shown below: External Level Logical Data Independence Conceptual Level Physical Data Independence 1. Physical Level: At the physical level, the information about the location of database objects in the data store is kept. Various users of DBMS are un- aware of the locations of these objects.In simple terms,physical level of a database describes how the data is being stored in secondary storage devices like disks and tapes and also gives insights on additional storage details. 2. Conceptual Level: At conceptual level, data is represented in the form of vari- ous database tables. For Example, STUDENT database may contain STU- DENT and COURSE tables which will be visible to users but users are un- aware of their storage.Also referred as logical schema,it describes what kind of data is to be stored in the database. 3. External Level: An external level specifies a view of the data in terms of conceptual level tables. Each external level view is used to cater to the needs of a particular category of users. For of a particular category of users. For Example, FACULTY of a university is in- terested in looking course details of students, STUDENTS are interested in looking at all details related to academics, accounts, courses and hostel details as well. So, different views can be generated for different users. The main focus of external level is data abstraction. Data Independence Data independence means a change of data at one level should not affect another level. Two types of data indepen- dence are present in this architecture: 1, Physical Data Independence: Any change in the physical location of tables and indexes should not affect the con- ceptual level or external view of data. This data indepen- dence is easy to achieve and implemented by most of the DBMS. 2. Conceptual Data Independence: The data at conceptual level schema and external level schema must be independent. This means a change in conceptual schema should not affect external schema. e.g.; Adding or delet- ing attributes of a table should not affect the user's view of the table. But this type of independence is difficult to achieve as compared to physical data independence be- cause the changes in conceptual schema are reflected in the user's view. Database Schema A database schema is the skeleton structure that represents the logical view of the entire database. It defines how the data is organized and how the relations among them are associated. It formulates all the constraints that are to be applied on the data. A database schema defines its entities and the relationship among them. It contains a descriptive detail of the database, which can be depicted by means of schema diagrams. It's the database designers who design the schema to help programmers understand the database and make it useful. > Student Logical Schema Physical Schema A database schema can be divided broadly into two categories - a Physical Database Schema - This schema pertains to the actual storage of data and its form of storage like files, indices, etc. It defines how the data will be stored in a secondary storage. a Logical Database Schema - This schema defines all the logical constraints that need to be applied on the data stored. It defines tables, views, and __ integrity constraints. DBMS Instance Definition of instance: The data stored in database at a particular moment of time is called instance of database. Database schema defines the variable declarations in tables that belong to a particular database; the value of these variables at a moment of time is called the instance of that database. For example, lets say we have a single table student in the database, today the table has 100 records, so today the instance of the database has 100 records. Lets say we are going to add another 100 records in this table by tomorrow so the instance of database tomorrow will have 200 records in table. In short, at a particular moment the data stored in database is called the instance, that changes over time when we add or delete data from the database. SQL | DDL, DQL, DML, DCL and TCL Commands Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks. These SQL commands are mainly categorized into four categories as: 1. DDL — Data Definition Language 2. DQ] — Data Query Language 3. DML — Data Manipulation Language 4. DCL — Data Control Language Though many resources claim there to be another category of SQL clauses TCL — Transaction Control Language. So we will see in detail about TCL as well. 1. DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database. Examples of DDL commands: ° O° fe} Oo CREATE — is used to create the database or its objects (like table, index, function, views, store procedure and triggers). DROP — is used to delete objects from the database. ALTER -is used to alter the structure of the database. TRUNCATE~is used to remove all records from a table, including all spaces allocated for the records are removed. COMMENT —is used to add comments to the data dictionary. RENAME —is used to rename an object existing in the database. 2. DQL (Data Query Language) : DML statements are used for performing queries on the data within schema objects. The purpose of DQL Command is to get some schema relation based on the query passed to it. Example of DQL: o SELECT — is used to retrieve data from the a database. 3. DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements. Examples of DML: o INSERT — is used to insert data intoa table. o UPDATE — is used to update existing data within a table. o DELETE — is used to delete records from a database table. . DCL(Data Control Language) : DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system. Examples of DCL commands: o GRANT-gives user’s access privileges to database. o REVOKE-withdraw user’s access privileges given by using the GRANT command. 5. TCL(transaction Control Language) : TCL commands deals with the transaction within the database. Examples of TCL commands: o COMMIT— commits a Transaction. ° ROLLBACK — rollbacks a transaction in case of any error occurs. ° SAVEPOINT —sets a savepoint within a transaction. o SET TRANSACTION - specify characteristics for the transaction. Database Administrators The life cycle of database starts from designing, implementing to administration of it. A database for any kind of requirement needs to be designed perfectly so that it should work without any issues. Once all the design is complete, it needs to be installed. Once this step is complete, users start using the database. The database grows as the data grows in the database. When the database becomes huge, its performance comes down. Also accessing the data from the database becomes challenge. There will be unused memory in database, making the memory inevitably huge. These administration and maintenance of database is taken care by database Administrator - DBA. A DBA has many responsibilities. A good performing database is in the hands of DBA. e Installing and upgrading the DBMS Servers: - DBA is responsible for installing a new DBMS server for the new projects. He is also responsible for upgrading these servers as there are new versions comes in the market or requirement. If there is any failure in upgradation of the existing servers, he should be able revert the new changes back to the older version, thus maintaining the DBMS working. He is also responsible for updating the service packs/ hot fixes/ patches to the DBMS servers. Design and implementation: - Designing the database and implementing is also DBA’s responsibility. He should be able to decide proper memory ¢ Design and implementation: - Designing the database and implementing is also DBA’s responsibility. He should be able to decide proper memory management, file organizations, error handling, log maintenance etc for the database. Performance tuning: - Since database is huge and it will have lots of tables, data, constraints and indices, there will be variations in the performance from time to time. Also, because of some designing issues or data growth, the database will not work as expected. It is responsibility of the DBA to tune the database performance. He is responsible to make sure all the queries and programs works in fraction of seconds. ee EE Migrate database servers: - Sometimes, users using oracle would like to shift to SQL server or Netezza. It is the responsibility of DBA to make sure that migration happens without any failure, and there is no data loss. Backup and Recovery: - Proper backup and recovery programs needs to be developed by DBA and has to be maintained him. This is one of the main responsibilities of DBA. Data/objects should be backed up regularly so that if there is any crash, it should be recovered without much effort and data loss. Security: - DBA is responsible for creating various database users and roles, and giving them different levels of access rights. e Security: - DBA is responsible for creating various database users and roles, and giving them different levels of access rights. ¢ Documentation: - DBA should be properly documenting all his activities so that if he quits or any new DBA comes in, he should be able to understand the database without any effort. He should basically maintain all his installation, backup, recovery, security methods. He should keep various reports about database performance. In order to perform his entire task, he should have very good command over DBMS. Types of DBA There are different kinds of DBA depending on the responsibility that he owns. e Administrative DBA - This DBA is mainly concerned with installing, and maintaining DBMS servers. His prime tasks are installing, backups, recovery, security, replications, memory management, configurations and tuning. He is mainly responsible for all administrative tasks of a database. ¢ Development DBA - He is responsible for creating queries and procedure for the requirement. Basically his task is similar to any database developer. ¢ Database Architect - Database architect is responsible for creating and maintaining the users, roles, access rights, tables, views, constraints and indexes. He is mainly responsible for designing the structure of the database depending on the requirement. These structures will be used by developers and development DBA to code. Data Warehouse DBA -DBA should be able to maintain the data and procedures from various sources in the datawarehouse. These sources can be files, COBOL, or any other programs. Here data and programs will be from different sources. A good DBA should be able to keep the performance and function levels from these sources at levels from these sources at same pace to make the datawarehouse to work. Application DBA -He acts like a bridge between the application program and the database. He makes sure all the application program is optimized to interact with the database. He ensures all the activities from installing, upgrading, and patching, maintaining, backup, recovery to executing the records works without any issues. OLAP DBA - He is responsible for installing and maintaining the database in OLAP systems. He maintains only OLAP databases.

You might also like