0% found this document useful (0 votes)
4 views11 pages

Lecture 10

SQL, or Structured Query Language, is the standard language used for managing and manipulating data in relational database systems. Key SQL commands include CREATE, SELECT, INSERT, UPDATE, DELETE, and DROP, which are categorized into Data Manipulation Language and Data Description Language. SQL offers various advantages such as data access, definition, and manipulation, along with the ability to embed within other programming languages.

Uploaded by

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

Lecture 10

SQL, or Structured Query Language, is the standard language used for managing and manipulating data in relational database systems. Key SQL commands include CREATE, SELECT, INSERT, UPDATE, DELETE, and DROP, which are categorized into Data Manipulation Language and Data Description Language. SQL offers various advantages such as data access, definition, and manipulation, along with the ability to embed within other programming languages.

Uploaded by

pchingwaru544
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

SQL Commands

Introduction

 SQLis Structured Query Language, which is a


computer language for storing, manipulating
and retrieving data stored in a relational
database. SQL is the standard language for
Relational Database System. All the Relational
Database Management Systems (RDMS) like
MySQL, MS Access, Oracle, Sybase, Informix,
Postgres and SQL Server use SQL as their
standard database language.
Why SQL?

 . SQL is widely popular because it offers the following advantages:


 Allows users to access data in the relational database management
systems.
 Allows users to describe the data.
 Allows users to define the data in a database and manipulate that data.
 Allows to embed within other languages using SQL modules, libraries &
pre-compilers.
 Allows users to create and drop databases and tables.
 Allows users to create view, stored procedure, functions in a database.
Allows users to set permissions on tables, procedures and views.
SQL Commands

 The standard SQL commands to interact with relational databases are


CREATE, SELECT, INSERT, UPDATE, DELETE and DROP. These
commands can be classified into the following groups based on their
nature:
 Data Manipulation Language
 Data Description Language
Data Manipulation Commands

 SELECT Retrieves certain records from


one or more tables.
 INSERT Creates a record.
 UPDATE Modifies records.
 DELETE Deletes records
Data Description Commands

 CREATE Creates a new table, a view of


a table, or other object in the database.
 ALTER Modifies an existing database
object, such as a table.
 DROP Deletes an entire table, a view
of a table or other objects in the
database
SQL Commands Syntax

 CREATE DATABASE (database name) SYNTAX


 CREATE DATABASE “Trust Academy”

This is will create a Database called Trust Academy


CreateTable

 CREATE TABLE (table name) SYNTAX


 (Field name, data type, allowable range, allowable characters,
NULL/NOT)
 First Name Text (20)
NOT NULL
 Surname Text (30)
NOT NULL
 I.D Integer (15)
NOT NULL SET AS P.K
Insert

 INSERT INTO <table name>


 VALUES (“x”, “x”, “x2”) SYNTAX
 INSERT INTO Student VALUES(“John”, “Moyo”, “223”)
DELETE

 DELETE * FROM <table name> the * represents all therefore this


command will delete all
 E.g. DELETE * FROM Students
 DELETE * FROM <table name>
 WHERE <condition>

You might also like