0% found this document useful (0 votes)
2 views1 page

05 Database SQL Basics

The document provides an overview of relational databases, explaining key concepts such as primary and foreign keys, and SQL commands like SELECT, INSERT, UPDATE, and DELETE. It also covers JOIN operations, data aggregation functions, and the importance of good database design to ensure data quality and clarity in relationships. Key constraints are highlighted as essential for maintaining data integrity.

Uploaded by

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

05 Database SQL Basics

The document provides an overview of relational databases, explaining key concepts such as primary and foreign keys, and SQL commands like SELECT, INSERT, UPDATE, and DELETE. It also covers JOIN operations, data aggregation functions, and the importance of good database design to ensure data quality and clarity in relationships. Key constraints are highlighted as essential for maintaining data integrity.

Uploaded by

ayushimehta020
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Database and SQL Basics

Original educational reference document

Relational Databases
A relational database stores information in tables made of rows and columns. Tables
can be related through keys.

Primary and Foreign Keys


A primary key uniquely identifies a row. A foreign key references a key in another table
and can represent relationships between records.

SELECT
SELECT retrieves data. WHERE filters rows, ORDER BY sorts results, and LIMIT
restricts the number of returned rows.

INSERT, UPDATE, DELETE


INSERT adds rows. UPDATE changes existing rows. DELETE removes rows. Always
use a precise WHERE clause when modifying or deleting selected records.

JOINs
INNER JOIN returns matching rows from related tables. LEFT JOIN keeps every row
from the left table and adds matching data from the right table when available.

Aggregation
COUNT, SUM, AVG, MIN, and MAX summarize data. GROUP BY creates groups for
aggregation, while HAVING filters grouped results.

Database Design
Good design reduces unnecessary duplication and makes relationships clear.
Constraints such as NOT NULL, UNIQUE, and FOREIGN KEY help protect data quality.

You might also like