0% found this document useful (0 votes)
3 views6 pages

Dbms First

Data base management system

Uploaded by

Rishav Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Dbms First

Data base management system

Uploaded by

Rishav Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PRINCE KUMAR

THAKUR
10323210014

Practical – 1
AIM:- Introduction to SQL

INTRODUCTION:
• SQL stands for Structured Query Language. It is used for storing and managing data in
relational database management system (RDMS).
• It is a standard language for Relational Database System. It enables a user to create, read,
update and delete relational databases and tables.
• All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as
their standard database language.
• SQL allows users to query the database in a number of ways, using English-like statements.

KEY CONCEPT IN SQL:

• PRIMARY KEY- A primary key, also called a primary keyword, is a column in a


relational database table that's distinctive for each record. It's a unique identifier, such as
a driver's license number, telephone number with area code or vehicle identification
number (VIN). A relational database must have only one primary key.
• FOREIGN KEY- A foreign key (FK) is a column or group of columns in a table that
links data in two tables in a relational database. It acts as a cross-reference between tables
by referencing the primary key of another table.

DATA TYPE SUPPORTED IN SQL-

• Numeric Types:
o INT - Integer.
o TINYINT - Small integer.
o SMALLINT - Medium-sized integer.
o MEDIUMINT - Medium-sized integer.
o BIGINT - Large integer.
o FLOAT - Single-precision floating-point.
o DOUBLE - Double-precision floating-point.
o DECIMAL - Fixed-point decimal.
• Date and Time Types:
o DATE - Date (YYYY-MM-DD).
PRINCE KUMAR
THAKUR
10323210014
o TIME - Time (HH:MM:SS).
o DATETIME - Date and time (YYYY-MM-DD HH:MM:SS).
o TIMESTAMP - Timestamp.
o YEAR - Year (YYYY).
• String Types:
o CHAR - Fixed-length character string.
o VARCHAR - Variable-length character string.
o TEXT - Variable-length text.
o BINARY - Fixed-length binary string.
o VARBINARY - Variable-length binary string.
o BLOB - Variable-length binary large object.
• Bit Type:
o BIT - Bit field type.
• Boolean Type:
o BOOLEAN - Synonym for TINYINT(1).

What is SQL?
Structured query language (SQL) is a programming language for storing and processing
information in a relational database. A relational database stores information in tabular form,
with rows and columns representing different data attributes and the various relationships
between the data values. You can use SQL statements to store, update, remove, search, and
retrieve information from the database. You can also use SQL to maintain and optimize
database performance.

Why is SQL important?

Structured query language (SQL) is a popular query language that is frequently used in all types
of applications. Data analysts and developers learn and use SQL because it integrates well with
different programming languages. For example, they can embed SQL queries with the Java
programming language to build high-performing data processing applications with major SQL
database systems such as Oracle or MS SQL Server. SQL is also fairly easy to learn as it uses
common English keywords in its statements
PRINCE KUMAR
THAKUR
10323210014
Some SQL commands:

1. CREATE
The command CREATE is used to create new objects in the database such as databases,
tables,indexes, views, etc.
PRINCE KUMAR
THAKUR
10323210014
Syntax:
CREATE TABLE table_name (
column1 datatype constraints,
column2 datatype constraints,
...
);

2. SELECT
Retrieves data from one or more tables.

Syntax:
SELECT column1, column2, ...
FROM table_name
WHERE condition;

3. DELETE
The DELETE command removes rows from a table. The condition in the WHERE
clause identifieswhich records are to be deleted. It deletes only data and not the structure
itself.
Syntax:

DELETE FROM table_name


WHERE condition;

4.INSERT
An SQL INSERT statement writes new rows of data into a table. If the INSERT activity
is successful, it returns the number of rows inserted into the table. If the row already
exists, it returns an error. Multiple rows can be inserted into a table.

Syntax:
PRINCE KUMAR
THAKUR
10323210014
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);

5. UPDATE
Definition: The UPDATE statement is used to alter existing data within a table.

Syntax:
UPDATE table_name
SET column1 =value1,
column2 = value2, ...
WHERE condition;

6.TRUNCATE

The TRUNCATE
command deletes all the
rows in a table but
maintains its structure.
Syntax:
TRUNCATE TABLE Categories;

7.DROP TABLE
Deletes a table and all of its data.

Syntax:
DROP TABLE table_name;

Result: We have studied the basics of SQL.


PRINCE KUMAR
THAKUR
10323210014
Pre-Viva questions:
1. What does SQL stand for?
2. What are the applications of SQL in real world?
3. What is the difference between primary key and foreign key?

Post-Viva questions:
4. Explain the different types of numeric data types supported by SQL.
5. Name the string data types available in SQL.

You might also like