- SQL - Discussion
- SQL - Useful Resources
- SQL - Useful Functions
- SQL - Quick Guide
- SQL - Questions and Answers
- SQL - Datatype Functions
- SQL - Conversion Functions
- SQL - JSON Functions
- SQL - Cursor Functions
- SQL - Logical Functions
- SQL - Statistical Functions
- SQL - Text & Image Functions
- SQL - Numeric Functions
- SQL - Aggregate Functions
- SQL - String Functions
- SQL - Date Functions
- SQL - Database Tuning
- SQL - IN vs EXISTS
- SQL - Group By vs Order By
- SQL - Common Table Expression
- SQL - Cursors
- SQL - Date & Time
- SQL - Auto Increment
- SQL - Using Sequences
- SQL - Handling Duplicates
- SQL - Sub Queries
- SQL - Transactions
- SQL - NULL Values
- SQL - Stored Procedures
- SQL - Default Constraint
- SQL - Check Constraint
- SQL - Null Functions
- SQL - Min & Max
- SQL - Hosting
- SQL - Injection
- SQL - Comments
- SQL - Wildcards
- SQL - Non-Clustered Index
- SQL - Clustered Index
- SQL - Unique Index
- SQL - Primary Key
- - 工会诉Join
- SQL - Inner Join
- SQL - Using Joins
- SQL - Aliases
- SQL - EXCEPT Operator
- SQL - INTERSECT Operator
- SQL - UNION vs UNION ALL
- SQL - UNION Operator
- SQL - BETWEEN Operator
- SQL - NOT NULL
- SQL - IS NOT NULL
- SQL - IS NULL
- SQL - NOT EQUAL
- SQL - NOT Operator
- SQL - CASE
- SQL - EXISTS Operator
- SQL - ANY, ALL Operators
- SQL - IN Operator
- SQL - LIKE Operator
- SQL - BOOLEAN (BIT) Operator
- SQL - AND & OR
- SQL - Having Clause
- SQL - Group By Clause
- SQL - Order By Clause
- SQL - Distinct Clause
- SQL - Top Clause
- SQL - Where Clause
- SQL - Rename Views
- SQL - Drop Views
- SQL - Update Views
- SQL - Create Views
- SQL - Sorting Results
- SQL - Delete Query
- SQL - Update Query
- SQL - Insert Into Select
- SQL - Select Into
- SQL - Select Query
- SQL - Insert Query
- SQL - Constraints
- SQL - Delete Table
- SQL - Drop Table
- SQL - Alter Tables
- SQL - Temporary Tables
- SQL - Clone Tables
- SQL - Truncate Table
- SQL - Rename Table
- SQL - Show Tables
- SQL - Create Table
- SQL - Backup Database
- SQL - Show Database
- SQL - Rename Database
- SQL - Select Database
- SQL - Drop Database
- SQL - Create Database
- SQL - Expressions
- SQL - Operators
- SQL - Data Types
- SQL - Syntax
- SQL - Databases
- SQL - RDBMS Concepts
- SQL - Overview
- SQL - Home
5. 图瓦卢
- 页: 1
- 页: 1
- 结构-创建指数
- 页: 1
- 页: 1
- 页: 1
- SQL - Foreign Key
- 文 件
- ∗ E/CN.6/2009/1。
- 页: 1
- 页: 1
- 文 件
- 页: 1
- 页: 1
- 文 件
- 页: 1
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SQL - RDBMS Concepts
What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems pke MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd in 1970.
What is a table?
The data in an RDBMS is stored in database objects known as tables. This table is basically a collection of related data entries and it consists of numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a relational database. Following is an example of a CUSTOMERS table which stores customer s ID, Name, Age, Salary, City and Country −
ID | Name | Age | Salary | City | Country |
---|---|---|---|---|---|
1 | Ramesh | 32 | 2000.00 | Hyderabad | India |
2 | Mukesh | 40 | 5000.00 | New York | USA |
3 | Sumit | 45 | 4500.00 | Muscat | Oman |
4 | Kaushik | 25 | 2500.00 | Kolkata | India |
5 | Hardik | 29 | 3500.00 | Bhopal | India |
6 | Komal | 38 | 3500.00 | Saharanpur | India |
7 | Ayush | 25 | 3500.00 | Delhi | India |
8 | Javed | 29 | 3700.00 | Delhi | India |
What is a field?
Every table is broken up into smaller entities called fields. A field is a column in a table that is designed to maintain specific information about every record in the table.
For example, our CUSTOMERS table consists of different fields pke ID, Name, Age, Salary, City and Country.
What is a Record or a Row?
A record is also called as a row of data is each inspanidual entry that exists in a table. For example, there are 7 records in the above CUSTOMERS table. Following is a single row of data or record in the CUSTOMERS table −
ID | Name | Age | Salary | City | Country |
---|---|---|---|---|---|
1 | Ramesh | 32 | 2000.00 | Hyderabad | India |
A record is a horizontal entity in a table.
What is a column?
A column is a vertical entity in a table that contains all information associated with a specific field in a table.
For example, our CUSTOMERS table have different columns to represent ID, Name, Age, Salary, City and Country.
What is a NULL value?
A NULL value in a table is a value in a field that appears to be blank, which means a field with a NULL value is a field with no value.
It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. A field with a NULL value is the one that has been left blank during a record creation. Following table has three records where first record has NULL value for the salary and second record has a zero value for the salary.
ID | Name | Age | Salary | City | Country |
---|---|---|---|---|---|
1 | Ramesh | 32 | Hyderabad | India | |
2 | Mukesh | 40 | 00.00 | New York | USA |
3 | Sumit | 45 | 4500.00 | Muscat | Oman |
SQL Constraints
Constraints are the rules enforced on data columns on a table. These are used to pmit the type of data that can go into a table. This ensures the accuracy and repabipty of the data in the database.
Constraints can either be column level or table level. Column level constraints are appped only to one column whereas, table level constraints are appped to the entire table.
Following are some of the most commonly used constraints available in SQL −
S.No. | Constraints |
---|---|
1 | Ensures that a column cannot have a NULL value. |
2 | Provides a default value for a column when none is specified. |
3 | Ensures that all the values in a column are different. |
4 | Uniquely identifies each row/record in a database table. |
5 | Uniquely identifies a row/record in any another database table. |
6 | Ensures that all values in a column satisfy certain conditions. |
7 | Used to create and retrieve data from the database very quickly. |
Data Integrity
The following categories of data integrity exist with each RDBMS −
Entity Integrity − This ensures that there are no duppcate rows in a table.
Domain Integrity − Enforces vapd entries for a given column by restricting the type, the format, or the range of values.
Referential integrity − Rows cannot be deleted, which are used by other records.
User-Defined Integrity − Enforces some specific business rules that do not fall into entity, domain or referential integrity.
Database Normapzation
Database normapzation is the process of efficiently organizing data in a database. There are two reasons of this normapzation process −
Epminating redundant data, for example, storing the same data in more than one table.
Ensuring data dependencies make sense.
Both these reasons are worthy goals as they reduce the amount of space a database consumes and ensures that data is logically stored. Normapzation consists of a series of guidepnes that help guide you in creating a good database structure.
Normapzation guidepnes are spanided into normal forms; think of a form as the format or the way a database structure is laid out. The aim of normal forms is to organize the database structure, so that it comppes with the rules of first normal form, then second normal form and finally the third normal form.
It is your choice to take it further and go to the Fourth Normal Form, Fifth Normal Form and so on, but in general, the Third Normal Form is more than enough for a normal Database Apppcation.