


















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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