Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

1) What Is Database ?: Uniqueness, Identification, Data Integrity, Referential Integrity, Indexing, Clustered Index

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1) What is Database ?

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.

2 What are Constraints in SQL?

NOT NULL, CHECK, DEFAULT, UNIQUE, INDEX, PRIMARY KEY, FOREIGN KEY

3)What is Primary 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,

4What is difference between primary key & Unique key ?

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.

CREATE PROCEDURE procedure_name


AS
sql_statement
GO;

11 Some commands

CREATE DATABASE databasename;

DROP DATABASE databasename;

BACKUP DATABASE databasename TO DISK = 'filepath';

CREATE TABLE table_name (column1 datatype,column2 datatype,column3 datatype,....);

DROP TABLE table_name;

ALTER TABLE table_name ADD column_name datatype;

12 What is View ?

Virtual table- Not present physical.


View is the result set of store query.
Read-only vs. Update only.
Materialized View - to store view in local from the server but it will take space.
We can also take multiple table data in one view.
To restrict data access- If we have 10 column in table and to showing 5 column it sufficient for user
then we will show 5 column. We shout revel all column to the user.
To make complex query easy- if we have 2021,2022,2023 record then we will create separate view
for this.
To present different view for same data - According to privilege level we can show the data

The IN operator allows you to specify multiple values in a WHERE clause.


The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates.
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
How To reduce home page time load.

1) Minify JS & CSS file.


2) JS & CSS file load should in Asynchronous .
3) Large JS & large images should load latter.
4) Choose right Hosting dependent your traffic on page.
5) Media compression /like image 100kb on page as per google.
6) Convert image in Next Gen format like webp.
7) Enable browser Cashing.
8) Aplly CDN(content deleviry system). --if you have traffic from other countries also then you should
take CDN it will increase your speed defiantly.
9) Optimize CSS.
10) Enable lazy load.
11) Check Speed on regular basis of your page.
12) Reduce server response time optimize query like /Indexing/take only those colouns witch you
need/caching/ CDN/ .

You might also like