Basics of Database Part 02
Normalization
- Decompose larger, complex table into simpler and smaller ones.
- Moves from lower normal forms to higher normal forms.
Normal Forms
- First normal form (1NF)
- Second normal form (2NF)
- Third normal form (3NF)
- Higher normal form (BCNF, 4NF, 5NF)
Need of Normalisation
- In order to produce good database design.
- To ensure all database operations to be efficiently performed.
- Avoid any expensive DBMS Operations.
- Avoid unnecessary replication of information.
Functional Dependency Types
- Partial functional Dependency
- Transitive Dependency
First normal form (1NF)
- All attributes in the relation are atomic (indivisible value)
- There are no repeating elements or group of elements
Second normal form (2NF)
- A relation is said to be in 2NF if and only if it is in 1st normal form
- No partial dependency exists between non key attributes and key attributes.
Third normal form (3NF)
- It is in 2NF. no transitive dependency exists between non key attributes and key attributes through another non key attributes.
What is SQL?
Programming language specifically designed for working with database to
- Create
- Manipulate
- Share/ Access
Why SQL?
- Allows users to communicate i.e. access and manipulate the database
- Allows users to retrieve data from database
- Allow users to create, update, modify and delete the database.
SQL Terms
Data: Data is defined as facts or figures or information that's stored in or used by a computer.
Database: A database is a organised collection of data/ Information so that it can be easily accessed managed and updated.
SQL Data Types
Numeric: bit, tinyint, smallint, int, bigint, decimal, numeric, float, real.
Character/ String: char, varchar, text
Date/Time: Date, Time, Datetime, Timestamp, Year.
Miscellaneous: Json, XML
SQL Constraints
Not Null: Ensures that a column does not have null value.
Default: Provides a default value for a column when none is specified.
Unique: Ensures that all the values in a column are different.
Primary: Identifies each row/ record in a database table uniquely.
Check: Ensures that all values in a column satisfy certain conditions.
Index: Create and retrieves data from the database very quickly.
#design #sql #data #share #database #programming #language #day2
Mail id: arpitmishra1629.ftp@gmail.com
Contact no: 8127430702
Linkedin: https://www.linkedin.com/in/arpit-mishra-9319b5131
👍
ReplyDelete