Download presentation
Presentation is loading. Please wait.
1
Structured query language This is a presentation by JOSEPH ESTRada on the beauty of Structured Query Language
2
So, what is SQL you ask? Language designed for the retrieval and management of data. Standard Data Manipulation Language(DML). Data definition language(DDL). Defines structure of the database.
3
Literal values (Strings, numbers, hexadecimal values, boolean values, bit-field values, null values) database, table, index, column, and alias names reserved words user-defined variables comments MYSql language structure
4
literal values string: character sequence in single or double quotes. optional “collate” clause used to specify collation. numbers: sequence of digits. hexadecimal values: Act as binary strings or 64-bit precision integers. Boolean values: booleans. bit-field values null values
5
mysql language structure cont... Identifiers: DB, table, index, column, and alias names. reserved words: SELECT, UPDATE, DELETE, etc... (pg 570) user-defined variables: SET @varr=value. allows shared data between statements. comments: #, --, /* */
6
Data Definition statements ALTER DATABASE: change characteristics of db. ALTER TABLE: change table structure/schema. CREATE DATABASE: creates new db. CREATE TABLE: creates new table. DROP DATABASE: removes a dB. DROP TABLE: removes a table. RENAME TABLE: changes table name.
7
Data manipulation statements (not complete) DELETe: deletes tuples insert: Insert tuples into a given table select: Relational projection operator update: Updates attribute/s
8
Aggregate functions avg(column): AVg of a column COUnt(column): number of rows w/o null value MAX(column): highest value of a column. MIN(column): Lowest value of a column. SUM(column): Total sum of a column.
9
Create TABLE (DDL)
10
INSERT INTO Course (DML)
11
group by Number of classes taught per instructor with GROUP by clause.
12
predicate Classes under CS department with units 3 or greater.
13
count Amount of courses taught by each department.
14
delete (DML) delete all tuples.
15
DROP TABLE (DDL) delete the table from the db.
16
EXIT(0)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.