Identify types of SQL statement Flashcards
What are common relational database management systems that use SQL?
- Microsoft SQL server
- MySQL
- PostgreSQL
- MariaDB
- Oracle
What is SQL?
SQL stands for Structured Query Language and is used to communicate with a relational database. It’s the standard language for relational database management systems (RBMS).
What SQL statements can be used to achieve almost everything you need to do with a database?
- Select
- Update
- Insert
- Delete
- Create
- Drop
What are common dialects of SQL?
- Transact-SQL (T-SQL): Use by by Microsoft SQL server and Azure SQL services.
- pgSQL: Use by PostgreSQL.
- PL (procedural language)/SQL: Use by Oracle.
What is Data Definition Language (DDL) and the common statements?
DDL statements are used to create, modify, and remove tables and other objects in a database (tables, stored procedures, views, etc.)
Common DDL statements:
* CREATE - create a new object in database
* ALTER - modify the structure of an object.
* DROP - remove an object from the database.
* RENANME - rename an exisiting object.
Example:
CREATE TABLE Product
(
ID INT PRIMARY KEY,
Name VARCHAR(20) NOT NULL,
Price DECIMAL NULL);
What is Data Control Language (DCL) and the common statements?
DCL statements are used to manage access to objects in a database by granting, denying, or revoking permissions to specific users or groups.
Main DCL statements:
* GRANT - grant permissions to perform specific actions.
* DENY - deny permissions to perform specific actions.
* REVOKE - remove previously granted permission.
Example:
GRANT SELECT, INSERT, UPDATE
ON Product TO user1;
What is Data Manipulation Language (DML) and the common statements?
DML statement are used to manipulate the rows in tables. They enable users to retrieve data, insert new rows, or modify existing rows.
Main statements:
* SELECT - read rows from a table
* INSERT - insert new rows into a table
* UPDATE - modify data in existing rows
* DELETE - delete exisiting rows
Example:
SELECT * FROM Customer WHERE City = “Seattle”: