


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This document provides a concise overview of database concepts and SQL. It covers database types (relational and NoSQL), SQL commands for CRUD operations, database structure, table creation, SQL datatypes, and DDL, DML, DCL, DQL, and TCL commands. Key concepts like primary and foreign keys, constraints, and advanced SQL features such as joins, subqueries, and views are explained. It serves as a quick reference for database management and SQL syntax, suitable for students and professionals. Examples include creating databases and tables, inserting and selecting data, using operators and clauses, aggregate functions, GROUP BY and HAVING clauses, cascading for foreign keys, different join types, and UNION and subqueries.
Typology: Study notes
1 / 58
This page cannot be seen from the preview
Don't miss anything!
Database Structure Database Table 1 Data Table 2 Data
What is a table? Student table
Creating our First Table
SQL Datatypes They define the type of values that can be stored in a column
Types of SQL Commands DDL (Data Definition Language) : create, alter, rename, truncate & drop DML (Data Manipulation Language) : select, insert, update & delete DCL (Data Control Language) : grant & revoke permission to users DQL (Data Query Language) : select TCL (Transaction Control Language) : start transaction, commit, rollback etc.
Database related Queries CREATE DATABASE db_name; DROP DATABASE db_name; SHOW DATABASES ; SHOW TABLES ; CREATE DATABASE IF NOT EXISTS db_name; DROP DATABASE IF EXISTS db_name;
Table related Queries
Select & View ALL columns
Table related Queries Insert
Keys table1 - Student table2 - City
Constraints NOT NULL SQL constraints are used to specify rules for data in a table. UNIQUE PRIMARY KEY columns cannot have a null value all values in column are different makes a column unique & not null but used only for one
Constraints CHECK it can limit the values allowed in a column
Create this sample table Insert this data