0% found this document useful (0 votes)
3 views

My sql intro

The document provides an introduction to SQL, covering installation, data types, basic queries, functions, joins, normalization, and commands. It explains the concepts of data, databases, and RDBMS, highlighting MySQL as a popular open-source relational database management system. Additionally, it includes details on SQL comments and their usage in queries.

Uploaded by

sree priya palle
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

My sql intro

The document provides an introduction to SQL, covering installation, data types, basic queries, functions, joins, normalization, and commands. It explains the concepts of data, databases, and RDBMS, highlighting MySQL as a popular open-source relational database management system. Additionally, it includes details on SQL comments and their usage in queries.

Uploaded by

sree priya palle
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Introduction to SQL

Installation of My SQL

SQL Data Types(Numeric, character, Date and time types, Boolean types)

Basic SQL Queries(Select, where, Order by, Group by, Distinct)

SQL Functions(Aggregation, scalar, Date functions)

Joins (Inner, Left, Right, Full outer, Cross, Self)

Normalization and indexing

Subqueries and Nested Queries(single-row, multi-row)

Set Operations(Union, Intersection, Except)

My SQL Commands(DML, DQL, DCL,TCL)

Constraints(Primary key, foreign, unique ,check ,default)

SQL Views

Stored Procedures and Functions

Data

• Definition: Data refers to raw facts and figures that do not have any specific meaning on
their own. It is the basic unit of information stored in or processed by a computer.

• Examples:

o Numbers: 123, 45.67

o Text: "John Doe", "IT Department"

o Dates: 2024-12-26

• Types of Data:

o Structured Data: Data that is organized into rows and columns (e.g., a table of
employee records in a database).

o Unstructured Data: Data without a predefined format (e.g., images, videos, audio
files).

Database

• Definition: A database is an organized collection of related data that can be accessed,


managed, and updated easily. It allows for efficient storage, retrieval, and manipulation of
data.
• Key Features:

o Data is stored in tables with rows and columns.

o Databases ensure data integrity, security, and consistency.

RDBMS (Relational Database Management System)

• Definition: An RDBMS is a software system that allows you to create, manage, and interact
with relational databases. It organizes data into tables (rows and columns) and uses
relationships between these tables.

• Key Features:

1. Data Storage in Tables: Each table stores related data in rows (records) and columns
(fields).

2. Relationships Between Tables: Tables can relate to one another using primary and
foreign keys.

3. SQL Support: Most RDBMSs use SQL as the query language.

4. ACID Properties: Ensures data consistency and reliability through Atomicity,


Consistency, Isolation, and Durability.

• Popular RDBMS Software:

o MySQL

o PostgreSQL

o Oracle Database

o Microsoft SQL Server

SQL (Structured Query Language)

• Definition: SQL is a standard programming language used to interact with relational


databases. It allows users to perform various operations like querying, inserting, updating,
and deleting data.

• MySQL is a relational database management system

• MySQL is open-source

• MySQL is free

• MySQL is ideal for both small and large applications

• MySQL is very fast, reliable, scalable, and easy to use

• MySQL is cross-platform

• MySQL is compliant with the ANSI SQL standard


• MySQL was first released in 1995

• MySQL is developed, distributed, and supported by Oracle Corporation

• MySQL is named after co-founder Ulf Michael "Monty" Widenius's daughter: My

MySQL Comments

Single Line Comments


Single line comments start with --.
The following example uses a single-line comment as an explanation:

-- Select all
SELECT * FROM Customers;

The following example uses a single-line comment to ignore the end of a line:

SELECT * FROM Customers -- WHERE City='Berlin';

The following example uses a single-line comment to ignore a statement:

-- SELECT * FROM Customers;


SELECT * FROM Products;

Multi-line Comments
Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored.

The following example uses a multi-line comment as an explanation:

/*Select all the columns


of all the records
in the Customers table:*/
SELECT * FROM Customers;

The following example uses a multi-line comment to ignore many statements:

/*SELECT * FROM Customers;


SELECT * FROM Products;
SELECT * FROM Orders;
SELECT * FROM Categories;*/
SELECT * FROM Suppliers;
The following example uses a comment to ignore part of a line:

SELECT CustomerName, /*City,*/ Country FROM Customers;

The following example uses a comment to ignore part of a statement:

SELECT * FROM Customers WHERE (CustomerName LIKE 'L%'


OR CustomerName LIKE 'R%' /*OR CustomerName LIKE 'S%'
OR CustomerName LIKE 'T%'*/ OR CustomerName LIKE 'W%')
AND Country='USA'
ORDER BY CustomerName;

You might also like