Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary - SQL

Rating
-
Sold
-
Pages
9
Uploaded on
18-01-2025
Written in
2024/2025

SQL Summary - SQL Basics interview preparation

Institution
Course

Content preview

1. Introduction to SQL

●​ SQL (Structured Query Language) is the standard language used for managing
and querying relational databases. It helps to store, modify, and retrieve data from
databases.
●​ Relational Databases store data in tables consisting of rows and columns. Tables
can be linked using keys, such as Primary Key (unique identifier for rows) and
Foreign Key (establishes a relationship between two tables).
●​ Popular SQL Databases:
○​ MySQL: Open-source, widely used for web applications.
○​ PostgreSQL: Open-source, supports advanced features and is known for
data integrity.
○​ SQL Server: Microsoft product, used for enterprise-level applications.
○​ SQLite: Lightweight, embedded SQL database, often used in mobile apps.




2. SQL Basics

●​ Basic SQL Syntax: SQL commands typically consist of clauses like SELECT, FROM,
WHERE, ORDER BY, LIMIT, and more. Each clause has a specific purpose, and
understanding the structure of SQL queries is critical.​ ​ ​ \\

Examples:

SELECT Statement:​

SELECT column1, column2 FROM table_name;

●​ Retrieves data from column1 and column2 from the table_name.

WHERE Clause: Filters rows based on a condition.​

SELECT * FROM employees WHERE salary > 50000;

●​ Retrieves all employees with a salary greater than 50,000.

ORDER BY Clause: Sorts the result set.​

SELECT * FROM employees ORDER BY salary DESC;

●​ Orders employees by salary in descending order.

LIMIT Clause: Limits the number of rows returned.​

SELECT * FROM employees LIMIT 5;

●​ Returns only the first 5 rows from the employees table.

, 3. Data Retrieval with SQL (SELECT Statement)

●​ SELECT: Retrieves data from one or more columns in a table.

DISTINCT: Avoids duplicates in the result set.​

SELECT DISTINCT department FROM employees;



WHERE Clause: Filters results based on a condition.​

SELECT name, department FROM employees WHERE department = 'IT';



●​ AND, OR, NOT:
○​ AND: Both conditions must be true.


SELECT * FROM employees WHERE salary > 50000 AND department = 'IT';



○​ OR: Either condition can be true.


SELECT * FROM employees WHERE salary > 50000 OR department = 'HR';



○​ NOT: Negates a condition.


SELECT * FROM employees WHERE NOT department = 'Finance';

Written for

Course

Document information

Uploaded on
January 18, 2025
Number of pages
9
Written in
2024/2025
Type
SUMMARY

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
gopirajanbme

Get to know the seller

Seller avatar
gopirajanbme PARK COLLEGE OF ENGINEERING AND TECHNOLOGY
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions