1) What Is Database ?: Uniqueness, Identification, Data Integrity, Referential Integrity, Indexing, Clustered Index
1) What Is Database ?: Uniqueness, Identification, Data Integrity, Referential Integrity, Indexing, Clustered Index
1) What Is Database ?: Uniqueness, Identification, Data Integrity, Referential Integrity, Indexing, Clustered Index
A database is a structured collection of data that is organized and stored electronically. It is designed
to efficiently manage, store, retrieve, and manipulate data, making it accessible for various
applications and users.
NOT NULL, CHECK, DEFAULT, UNIQUE, INDEX, PRIMARY KEY, FOREIGN KEY
primary key is a field or a set of fields in a database table that uniquely identifies each row in that
table. Purpose of primary key are Uniqueness, Identification, Data Integrity, Referential Integrity,
Indexing, Clustered Index,
1) primary key ensure that each row should be 1) Unique Key ensure that not 2 column have
unique same value in table.
2) Null value not allow in columns. 2) Multiple Null value allow in Unique kay.
3)
5 What is indexing?
Indexing using fast retrieval data from the database. Indexing follow b-tree method. Indexing like a
book index it .
6 JOINS IN SQL
(INNER) JOIN: Returns records that have matching values in both tables
LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right
table
RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left
table
FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
SELECT ProductID FROM Products INNER JOIN Categories ON Products.CategoryID =
Categories.CategoryID;
7 GROUP BY
The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of
customers in each country".
The GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group
the result-set by one or more columns.
8 UNION
The UNION operator is used to combine the result-set of two or more SELECT statements.
Every SELECT statement within UNION must have the same number of columns
The columns must also have similar data types
The columns in every SELECT statement must also be in the same order
9 Trigger: is a database object that is associated with a table and automatically executes a set of SQL
statements when a specific event occurs on that table.
10 What is a Stored Procedure?
A stored procedure is a prepared SQL code that you can save, so the code can be reused over and over
again.
So if you have an SQL query that you write over and over again, save it as a stored procedure, and then just
call it to execute it.
You can also pass parameters to a stored procedure, so that the stored procedure can act based on the
parameter value(s) that is passed.
11 Some commands
12 What is View ?