
Search In
This function is used to get the minimum value from the selected field .
Syntax :
select min ( column_name ) from table_name ;
Example :
Table name : Employee_Info
Id Employee_name Employee_Age Employee _Salary
1
To return the number of rows in a query,we use COUNT. It counts the numbers of records.
the syntax of SQL COUNT statement.
SELECT COUNT (expression)
FROM tables
WHERE conditions;
SQL SELECT COUNT(column_name)
SELECT COUNT(name) FROM empl
Keys are used to uniquely identify records in a table. it is used to establish relation within a table.
Primary keys,Foreign keys, candidate keys and alternate keys are used in tables which identify rows.
All keys other than primary key are Alterna
It limits the value range which is mentioned in column.
Example of check constraint
CREATE TABLE Persons
(
PId int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
CONSTRAINT chkPerson CHECK
Hello All,
Many time, We want to know that, What are all the tables who have referenced a column as a "foreign key" which is a "Primary Key" of other table.
Example:-- In a database I have one Company table which stores company information with Co
1. CREATE DATABASE
Create database is a type of command used to create new SQL database.
Here is the syntax of CREATE DATABASE statement:-
CREATE DATABASE DatabaseName;
2.DROP DATABASE
Drop database is a type of command used to drop any exist
By using INSERT INTO SELECT Statement one can copy data from one table to other existing table.
Syntax:
To copy all the columns from one table to another table:
INSERT INTO table_name1 (SELECT * from table_name);
To copy only the selected columns
Schema or Structure can be defined in SQL
A schema is a collection of logical structures of data objects. A schema is associated with a database user and has the same name as that user. Each user have a single schema. Schema is mainly collection of
Many times the large size of transaction log file (.ldf) in Microsoft SQL is too big which leads to performance issues and loss of valuable disk space.Therefore it's imperative to periodically do database maintenance.
In order to clear or shrink
Many times we need to truncate a table which has an FK constraint on it. Typically we get the following error:
Cannot truncate table 'TableName' because it is being referenced by a FOREIGN KEY constraint.
The solution to the above problem is to fol
