What is a Database?
A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS).
What is a DBMS?
A DBMS serves as an interface between the database and its end users or programs, allowing users to retrieve, update, and manage how the information is organized and optimized.
Some examples of popular database software or DBMSs include MySQL, Microsoft Access, Microsoft SQL Server, FileMaker Pro, Oracle Database, and dBASE.
What is SQL?
SQL stands for Structured Query Language and is a programming language that is used to interact with databases. It is a standard language for storing, manipulating and retrieving data in databases. It let one access and manipulate databases.
Applications Of SQL
1. Create: SQL can create new databases, new tables and views in a database.
2. Read: SQL can execute queries against a database and can retrieve data from a database.
3. Update: SQL can insert and update records in a database. It can set permissions on tables, procedures, and views in database.
4. Delete: SQL can delete records from a database.
Using SQL In Your WebSite
To build a website that shows data from a database, you will need:
1. An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
2. To use a server-side scripting language, like PHP or ASP.
3. To use SQL to retrive the data.
4. To use HTML / CSS to style the web-page.
SQL Commands
1. Data Definition Language (DDL): It consists of the SQL commands that can be used to define the database schema.
List of DDL commands:
• CREATE: This command is used to create the database or its objects.
• DROP: This command is used to delete objects from the database.
• ALTER: This is used to alter the structure of the database.
• TRUNCATE: This is used to remove all records from a table, including all spaces allocated for the records are removed.
• COMMENT: This is used to add comments to the data dictionary.
• RENAME: This is used to rename an object existing in the database.
2. Data Manipulation Language (DML): It consists of SQL commands that deal with the manipulation of data present in the database.
List of DML commands:
• INSERT: It is used to insert data into a table.
• UPDATE: It is used to update existing data within a table.
• DELETE: It is used to delete records from a database table.
• LOCK: Table control concurrency.
3. Data Control Language (DCL): It consists of SQL commands which mainly deal with the rights, permissions, and other controls of the database system.
List of DCL commands:
• GRANT: This command gives users access privileges to the database.
• REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.
4. Data Query Language (DQL): It consists of SQL commands which are used for performing queries on the data within schema objects.
List of DQL commands:
• SELECT: It is used to retrieve data from the database.
5. Transaction Control Language (TCL): Transactions group a set of tasks into a single execution unit. Each transaction begins with a specific task and ends when all the tasks in the group are completed. SQL commands that controls the execution of transactions TCL commands.
List of TCL commands:
• BEGIN: It is used to open a transaction.
• COMMIT: It is used to commit a transaction.
• ROLLBACK: It rollbacks a transaction in case of any error occurs.
• SAVEPOINT: It sets a save point within a transaction.
In the next blog, we will discuss SQL Structure , DataTypes, Primary & Foreign Key etc.
thanks for your time.
If you liked this article, consider following me on Hashnode for my latest publications.