Bdms Long
Bdms Long
4. Explain characteristics of SQL and different types of SQL data type? 2. Explain the process of normalization and its various normal forms (1NF, 2NF, 3NF, BCNF).
Ans: An aggregate function or aggregation function is a function where multiple values are Ans: Characteristics of SQL Provide an example for each.
processed together to form a single summary statistic. The different types of aggregate function are: 1.SQL is easy to learn. Ans: Normalization is the process of minimizing redundancy from a relation or set of relations.
1. COUNT FUNCTION: COUNT function is used to Count the number of rows in a database table. 2.SQL is used to access data from relational database management systems. Redundancy in relation may cause insertion, deletion, and update anomalies. So, it helps to
It can work on both numeric and non-numeric data types. COUNT function uses the COUNT(*) 3.SQL can execute queries against the database. minimize the redundancy in relations. Normal forms are used to eliminate or reduce redundancy in
that returns the count of all the rows in a specified table. COUNT(*) considers duplicate and Null. 4.SQL is used to describe the data. database tables.
Syntax 1. COUNT(*) 5.SQL is used to define the data in the database and manipulate it when needed. First Normal Form (1NF): A relation will be 1NF if it contains an atomic value. It states that an
2. or 3. COUNT( [ALL|DISTINCT] expression ) 6.SQL is used to create and drop the database and table. attribute of a table cannot hold multiple values. It must hold only single-valued attribute. First
2. SUM Function: Sum function is used to calculate the sum of all selected columns. It works on 7.SQL is used to create a view, stored procedure, function in a database. normal form disallows the multi-valued attribute, composite attribute, and their combinations.
numeric fields only. 8.SQL allows users to set permissions on tables, procedures, and views. Example: Relation EMPLOYEE is not in 1NF because of multi-valued attribute EMP_PHONE.
Syntax SQL data types can be broadly divided into the following categories.
SUM() or 1.Numeric data types such as: INT, TINYINT, BIGINT, FLOAT, REAL, etc.
SUM( [ALL|DISTINCT] expression ) 2.Date and Time data types such as: DATE, TIME, DATETIME, etc.
3. AVG function: The AVG function is used to calculate the average value of the numeric type. AVG 3.Character and String data types such as: CHAR, VARCHAR, TEXT, etc.
function returns the average of all non-Null values. Syntax AVG() or AVG( [ALL|DISTINCT] 4.Unicode character string data types such as: NCHAR, NVARCHAR, NTEXT, etc.
expression ) 5.Binary data types such as: BINARY, VARBINARY, etc.
4. MAX Function: MAX function is used to find the maximum value of a certain column. This 6.Miscellaneous data types - CLOB, BLOB, XML, CURSOR, TABLE, etc.
function determines the largest value of all selected values of a column.
Syntax MAX() or 1.explain DBMS architecture of DBMS?
MAX( [ALL|DISTINCT] expression ) Ans: A Database stores a lot of critical information to access data quickly and securely. Hence it is Second Normal Form (2NF): In the 2NF, relational must be in 1NF. In the second normal form, all
5. MIN Function: MIN function is used to find the minimum value of a certain column. This important to select the correct architecture for efficient data management. DBMS Architecture helps non-key attributes are fully functional dependent on the primary key Example: A school can store
function determines the smallest value of all selected values of a column. users to get their requests done while connecting to the database. We choose database architecture the data of teachers and the subjects they teach. In a school, a teacher can teach more than one
Syntax MIN() or depending on several factors like the size of the database, number of users, and relationships subject.
MIN( [ALL|DISTINCT] expression ) between the users. There are two types of database models that we generally use, logical model and
physical model. Several types of architecture are there in the database which we will deal with in
the next section. Types:::
3. What are triggers? Explain advantages and disadvantages of triggers. 1-Tier Architecture
Ans: A trigger is a special kind of stored procedure that is activated ("triggered") in response to a 2-Tier Architecture
particular event in a database. trigger is called automatically when a data modification event occurs 3-Tier Architecture
against a table. 1-Tier Architecture
ADVANTAGES OF TRIGGERS In 1-Tier Architecture the database is directly available to the user, the user can directly sit on the
• Triggers set database object rules and roll back if any change does not satisfy those rules. The DBMS and use it that is, the client, server, and Database are all present on the same machine. For
trigger will inspect the data and make changes if necessary. Example: to learn SQL we set up an SQL server and the database on the local system. This enables
• Triggers help us to enforce data integrity. • Triggers help us to validate data before inserted or us to directly interact with the relational database and execute operations. The industry won’t use Third Normal Form (3NF): A relation will be in 3NF if it is in 2NF and not contain any transitive
updated. this architecture they logically go for 2-tier and 3-tier Architecture.2-Tier Architecture partial dependency. 3NF is used to reduce the data duplication. It is also used to achieve the data
• Triggers help us to keep a log of records. • Triggers increase SQL queries' performance because The 2-tier architecture is similar to a basic client-server model. The application at the client end integrity. If there is no transitive dependency for non-prime attributes, then the relation must be in
they do not need to compile each time they are executed. directly communicates with the database on the server side. APIs like ODBC and JDBC are used for third normal form.
• Triggers reduce the client-side code that saves time and effort. this interaction. The server side is responsible for providing query processing and transaction Example:
• Triggers are easy to maintain. DISADVANTAGES OF TRIGGERS management functionalities. On the client side, the user interfaces and application programs are run.
•Triggers are invoked automatically, and their execution is invisible to the user. Therefore, it isn't The application on the client side establishes a connection with the server side to communicate with
easy to troubleshoot what happens in the database layer. the DBMS.
• Triggers may increase the overhead of the database server. An advantage of this type is that maintenance and understanding are easier, and compatible with
• We can define the same trigger action for multiple user actions such as INSERT and UPDATE in existing systems3-Tier Architecture
the same CREATE TRIGGER statement. In 3-Tier Architecture, there is another layer between the client and the server. The client does not
• We can create a trigger in the current database only, but it can reference objects outside the current directly communicate with the server. Instead, it interacts with an application server which further
database. communicates with the database system and then the query processing and transaction management Boyce-Codd Normal Form (BCNF): BCNF is the advance version of 3NF. It is stricter than 3NF. A
takes place. This intermediate layer acts as a medium for the exchange of partially processed data table is in BCNF if every functional dependency X → Y, X is the super key of the table. For BCNF,
between the server and the client. This type of architecture is used in the case of large web the table should be in 3NF, and for every FD, LHS is super key.
applications. Example: Let's assume there is a company where employees work in more than one department.