STRUCTURED QUERY LANGUAGE OVERVIEW, Summaries of Database Management Systems (DBMS)

These lecture notes provide a high-level overview of SQL , offering learners a broad understanding of how SQL is used to manage and manipulate data in relational databases. this overview focuses on the purpose, structure, and key features of SQL without diving too deeply into code. Topics covered include: - The structure of relational databases - SQL categories: - Data Definition Language – `CREATE`, `ALTER`, `DROP` - Data Manipulation Language – `SELECT`, `INSERT`, `UPDATE`, `DELETE` - Data Control Language – `GRANT`, `REVOKE` - Transaction Control Language – `COMMIT`, `ROLLBACK`, `SAVEPOINT` - Introduction to tables, rows, columns, and relationships - Keys and constraints (Primary Key, Foreign Key, Unique, Not Null) - SQL syntax basics and case insensitivity - Overview of joins By the end of these notes, learners will have a clear understanding of what SQL is, how it works, and why it is essential for working with relational databases.

Typology: Summaries

2024/2025

Uploaded on 04/05/2025

ochiria-elias-onyait
ochiria-elias-onyait 🇺🇬

7 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SQL Overview
SQL is a programming language for Relational Databases. It is designed over relational algebra
and tuple relational calculus. SQL comes as a package with all major distributions of RDBMS.
SQL comprises both data definition and data manipulation languages. Using the data definition
properties of SQL, one can design and modify database schema whereas data manipulation
properties allows SQL to store and retrieve data from database.
Data definition Language
SQL uses the following set of commands to define database schema:
CREATE
Creates new databases, tables and views from RDBMS
For example:
Create database tutorialspoint;
Create table article;
Create view for_students;
DROP
Drop commands deletes views, tables and databases from RDBMS
Drop object_type object_name;
Drop database tutorialspoint;
Drop table article;
Drop view for_students;
ALTER
Modifies database schema.
Alter object_type object_name parameters;
for example:
Alter table article add subject varchar;
This command adds an attribute in relation article with name subject of string type.
Alter table article drop subject;
This command drops an attribute in relation article with name subject.
Data Manipulation Language
SQL is equipped with data manipulation language. DML modifies the database instance by
inserting, updating and deleting its data. DML is responsible for all data modification in databases.
SQL contains the following set of command in DML section:
SELECT/FROM/WHERE
INSERT INTO/VALUES
UPDATE/SET/WHERE
pf3

Partial preview of the text

Download STRUCTURED QUERY LANGUAGE OVERVIEW and more Summaries Database Management Systems (DBMS) in PDF only on Docsity!

SQL Overview SQL is a programming language for Relational Databases. It is designed over relational algebra and tuple relational calculus. SQL comes as a package with all major distributions of RDBMS. SQL comprises both data definition and data manipulation languages. Using the data definition properties of SQL, one can design and modify database schema whereas data manipulation properties allows SQL to store and retrieve data from database. Data definition Language SQL uses the following set of commands to define database schema: CREATE Creates new databases, tables and views from RDBMS For example: Create database tutorialspoint; Create table article; Create view for_students; DROP Drop commands deletes views, tables and databases from RDBMS Drop object_type object_name; Drop database tutorialspoint; Drop table article; Drop view for_students; ALTER Modifies database schema. Alter object_type object_name parameters; for example: Alter table article add subject varchar; This command adds an attribute in relation article with name subject of string type. Alter table article drop subject; This command drops an attribute in relation article with name subject. Data Manipulation Language SQL is equipped with data manipulation language. DML modifies the database instance by inserting, updating and deleting its data. DML is responsible for all data modification in databases. SQL contains the following set of command in DML section:  SELECT/FROM/WHERE  INSERT INTO/VALUES  UPDATE/SET/WHERE

 DELETE FROM/WHERE

These basic constructs allow database programmers and users to enter data and information into the database and retrieve efficiently using a number of filter options. SELECT/FROM/WHERE SELECT This is one of the fundamental query command of SQL. It is similar to projection operation of relational algebra. It selects the attributes based on the condition described by WHERE clause. FROM This clause takes a relation name as an argument from which attributes are to be selected/projected. In case of more than one relation names are given this clause corresponds to Cartesian product. ( Read about Cartesian product) WHERE This clause defines predicate or conditions which must match in order to qualify the attributes to be projected. For example: Select author_name From book_author Where age > 50; This command will project names of author’s from book_author relation whose age is greater than

INSERT INTO/VALUES This command is used for inserting values into rows of table (relation). Syntax is INSERT INTO table (column1 [, column2, column3 ... ]) VALUES (value1 [, value2, value3 ... ]) Or INSERT INTO table VALUES (value1, [value2, ... ]) For Example: INSERT INTO tutorialspoint (Author, Subject) VALUES ("anonymous", "computers"); UPDATE/SET/WHERE This command is used for updating or modifying values of columns of table (relation). Syntax is UPDATE table_name SET column_name = value [, column_name = value ...]