SQL Project File
SQL Project File
SQL Project File
JALANDHAR BYPASS,LUDHIANA
INFORMATICS PRACTICES
(SESSION:2024-25)
PRACTICAL FILE
1. About MySQL
2. DDL commands
3. DML commands
4. DQL commands
5. Practicals
About My SQL
SQL (Structured Query Language) is a standard language for accessing and
Manipulating databases. SQL commands are used to create, transform and retrieve
information from Relational Database Management Systems (RDBMS) and also to
create an interface between the user and database. By using SQL commands, one
can create database and perform other functions like creating tables,
adding records, modifying data, etc.
# DDL commands
1. Creating Databases
Syntax-
CREATE DATABASE <database_name>
For example,
2. Opening Databases
Syntax-
USE <database_name>
For example,
3. Removing Databases
Syntax-
DROP DATABASE <database_name>
For example,
4. Creating a Table
Syntax-
CREATE TABLE <table_name>
(
<column_name1><data_type>[(size)],(constraints, if any)
<column_name2><data_type>[(size)],
…
);
For example,
# DQL commands
->SQL SELECT statement
1. Projection
For example,
2. Selection
Syntax-
SELECT * FROM <table_name>
WHERE <conditions_to_satisfy>;
For example,
-> Using WHERE clause
For example,
3. Re-ordering Columns
For example,
2. OR operator
For example,
3. NOT operator
For example,
D. SQL Special Operators
1. BETWEEN
Syntax-
SELECT <column_name> FROM <table_name>
WHERE <column_name> BETWEEN <value1> AND <value2>;
For example,
2. IN
Syntax-
SELECT <column_name> FROM <table_name>
WHERE <column_name> IN (value1,value2,…);
For example,
3. NULL
For example,
4. LIKE
Syntax-
SELECT <column_name> FROM <table_name>
WHERE <column_name> LIKE <pattern>;
For example,
->Sorting in SQL
Syntax-
SELECT <column_list> FROM <table_name>
WHERE <condition> ORDER BY <column_name>[ASC|DESC];
For example,
PRACTICALS
#1 Creating table SKILL_SUBJECTS_PREFERENCE