4th Assignment
4th Assignment
1. ACID principle
ACID is an acronym for (Atomicity Consistency Isolation Durability). It a concept
used to evaluate databases and application architectures. For a reliable database all
these four attributes should be achieved.
Atomicity is all-or-none proposition.
Consistency guarantees that a transaction never leaves your database in a half-
finished state.
Isolation keeps the transactions separated from each other until they’re finished.
Durability guarantees that a database will keep track of pending changes in such a
way that the server can recover from an abnormal termination.
All these four rules are very important for any developers dealing in database.
2. Temporary table
A temporary table is that type of table that is visible only to the current session, and is
dropped automatically when the session in which it was created is closed. They are
not stored in the database permanently so it would be useful in situation where you
need table for a short time to perform some kind of testing after which you want it to
disappear.
2NF
A relation will be in 2NF if it is in 1NF and all non-key attributes are fully functional
dependent on the primary key.
3NF
A relation will be in 3NF if it is in 2NF and no transition dependency exists.
4NF
A relation will be in 4NF if it is in Boyce Codd normal form and has no multi-valued
dependency.
5NF
A relation is in 5NF if it is in 4NF and not contains any joins dependency and joining
should be lossless.
4. Testing
Database Testing is checking the schema, tables, triggers, etc. of the database under
test. It may involve creating complex queries to load/stress test the database and check
its responsiveness. It Checks data integrity and consistency.
5. ER diagram
Entity relationship diagram displays the relationships of entity set stored in a
database. In other words, we can say that ER diagrams help you to explain the logical
structure of databases. At first look, an ER diagram looks very similar to the
flowchart. However, ER Diagram includes many specialized symbols, and its
meanings make this model unique.
Uses of ER diagram
Entities
Attributes
Relationships
6. Class Diagram
Class Diagram gives the static perspective on an application. A class diagram depicts
the kinds of items in the framework and the various sorts of connections that exist
among them. This displaying strategy can run with practically all Object-Oriented
Methods. A class can allude to another class. A class can have its items or may
acquire from different classes.
Class Diagram helps build the code for the product application advancement.
7. DF Diagram
Words usually can't do a picture justice. A Data Flow Diagram (DFD) is a customary
method to picture the data streams inside a framework. A slick and clear DFD can
delineate a decent measure of the framework necessities graphically. It very well may
be manual, mechanized, or a mix of both.
It shows how data enters and leaves the framework, what changes the data and where
data is put away. The reason for a DFD is to show the extension and limits of a
framework all in all. It might be utilized as a specialized instrument between a
frameworks expert and any individual who has an impact in the framework that goes
about as the beginning stage for overhauling a framework.
8. Join
There are four fundamental sorts of SQL joins: inner, left, right, and full. The simplest
and most natural approach to clarify the distinction between these four kinds is by
utilizing a Venn chart, which shows all conceivable consistent relations between
informational collections.
Once more, it's critical to stretch that before you can start utilizing any join type,
you'll have to separate the information and burden it into a RDBMS like Amazon
Redshift, where you can inquiry tables from numerous sources. You fabricate that
procedure physically, or you can utilize an ETL administration like Stitch, which
mechanizes that procedure for you.
The degree of the overlap, assuming any, is controlled by what number of records in
Table A match the records in Table B. Contingent upon what subset of information
we might want to choose from the two tables, the four join types can be imagined by
featuring the comparing areas of the Venn outline:
Select all records from Table A and Table B, where the join condition is met.
Select all records from Table A, along with records from Table B for which the join
condition is met (if at all).
Select all records from Table B, along with records from Table A for which the join
condition is met (if at all).
Select all records from Table A and Table B, regardless of whether the join condition
is met or not.
9. Try catch
The SQL Try Catch helps you to handle the errors in query effectively. For example,
we write a series of statements inside the TRY block. If the SQL Server finds an error,
then it exits from the TRY block and enters into the CATCH block, it executes the
statements inside the CATCH block. And lastly, it will return the corresponding error
description.
Things to remember:
Coming up next are the rundown of things that you need to recollect before you begin
working with the SQL Try get
The CATCH square should promptly follow each TRY square. You are not permitted
to incorporate any announcements between the END TRY, and BEGIN CATCH
On the off chance that there are no mistakes in a TRY hinder, the control won't go
into the CATCH square. It implies the controller will execute articulations after the
END CATCH.
On the off chance that there is a mistake in the TRY square, it quickly exits from the
Try square and goes into the Catch square.
The SQL TRY CATCH will get all the mistakes whose seriousness is higher than the
10, and lower than 20.
SQL permits you to utilize the Nested TRY squares (TRY CATCH inside another).
Be that as it may, CATCH square cannot deal with the gather blunders like Syntax
mistakes
Output
10. Difference between SP and function
The function always returns a value. Stored Procedure will not return a value, but the
procedure can return “0” or n values.
Functions have only input parameters for it. Whereas, Procedures can have output or input
parameters.
You can call Functions can be from Procedure. But the vice-versa is not correct. As you can’t call
Procedures from a Function.
References
https://intellipaat.com/community/3394/function-vs-stored-procedure-in-sql-server
https://www.guru99.com/
https://www.tutorialspoint.com/sql/index.htm