




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































What is data?
Memory utilisation well in dbms Memory utilisation poor in file system No data inconsistency in dbms Inconsistency in file system DBMS gives an abstract view of data that hides the details. File system provides the detail of the data representation and storage of data. DBMS provides a crash recovery mechanism, i.e., DBMS protects the user from the system failure. File system doesn't have a crash mechanism, i.e., if the system crashes while entering some data, then the content of the file will lost. DBMS provides a good protection mechanism. It is very difficult to protect a file under the file system. DBMS contains a wide variety of sophisticated techniques to store and retrieve the data. File system can't efficiently store and retrieve the data. DBMS takes care of Concurrent access of data using some form of locking. In the File system, concurrent access has many problems like redirecting the file while other deleting some information or updating some information.
1 - Tier Architecture
Network Model The network database model allows each child to have multiple parents. It helps you to address the need to model more complex relationships like as the orders/parts many-to-many relationship. In this model, entities are organized in a graph which can be accessed through several paths. Relational model Relational DBMS is the most widely used DBMS model because it is one of the easiest. This model is based on normalizing data in the rows and columns of the tables. Relational model stored in fixed structures and manipulated using SQL. Entity-Relationship Model Entity-Relationship (ER) Model is based on the notion of real-world entities and relationships among them. While formulating real-world scenario into the database model, the ER Model creates entity set, relationship set, general attributes and constraints. DBMS languages
Database languages are used to read, update and store data in a database. There are several such languages that can be used for this purpose; one of them is SQL (Structured Query Language).
Syntax: DROP object object_name; Examples: DROP TABLE table_name; table_name: Name of the table to be deleted. DROP DATABASE database_name; database_name: Name of the database to be deleted. TRUNCATE It is used to remove all records from a table, including all spaces The TRUNCATE TABLE mytable statement is logically (though not physically) equivalent to the DELETE FROM mytable statement (without a WHERE clause). Syntax: TRUNCATE TABLE table_name; DROP vs TRUNCATE
ADD (Columnname_1 datatype, Columnname_2 datatype, … Columnname_n datatype); ALTER TABLE – DROP DROP COLUMN is used to drop column in a table. Deleting the unwanted columns from the table. Syntax: ALTER TABLE table_name DROP COLUMN column_name; ALTER TABLE-MODIFY It is used to modify the existing columns in a table. Multiple columns can also be modified at once. ALTER TABLE table_name MODIFY column_name column_type; QUERY: To ADD 2 columns AGE and COURSE to table Student. ALTER TABLE Student ADD (AGE number(3),COURSE varchar(40)); MODIFY column COURSE in table Student ALTER TABLE Student MODIFY COURSE varchar(20); Comments As is any programming languages comments matter a lot in SQL also. In this set we will learn about writing comments in any SQL snippet. Comments can be written in the following three formats:
INSERT INTO Student (ROLL_NO, NAME, Age) VALUES (‘5′,’PRATIK’,’19’); UPDATE Statement The UPDATE statement in SQL is used to update the data of an existing table in database. We can update single columns as well as multiple columns using UPDATE statement as per our requirement. Basic Syntax: UPDATE TableName SET column_name1 = value, column_name2 = value.... WHERE condition; EX1: SQL> UPDATE EMPLOYEES SET EMP_SALARY = 10000 WHERE EMP_AGE > 25; EX2; SQL> UPDATE EMPLOYEES SET EMP_SALARY = 120000 WHERE EMP_NAME = 'Apoorv'; DELETE Statement The DELETE Statement in SQL is used to delete existing records from a table. We can delete a single record or multiple records depending on the condition we specify in the WHERE clause. Basic Syntax: DELETE FROM table_name WHERE some_condition; Deleting single record: Delete the rows where NAME = ‘Ram’. This will delete only the first row. DELETE FROM Student WHERE NAME = 'Ram'; Deleting multiple records: Delete the rows from the table Student where Age is 20. This will delete 2 rows(third row and fifth row). DELETE FROM Student WHERE Age = 20; Delete all of the records: There are two queries to do this as shown below, query1: "DELETE FROM Student"; query2: "DELETE * FROM Student"; 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:
GRANT-gives user’s access privileges to database. REVOKE-withdraw user’s access privileges given by using the GRANT command. TCL(transaction Control Language ) : TCL commands deals with the transaction within the database. Examples of TCL commands: COMMIT– commits a Transaction. ROLLBACK– rollbacks a transaction in case of any error occurs. SAVEPOINT–sets a savepoint within a transaction. SET TRANSACTION–specify characteristics for the transaction. What is the Procedure for Database Access?