Stands for "Structured Query Language."
SQL is a query language used to access and modify information in a database. Web developers use SQL to connect websites and web applications to databases, creating dynamic webpages that can display up-to-date information each time they load. SQL is a standard language for database queries, used by many different database management systems like Oracle Database and MySQL.
Websites and web apps use SQL statements to query relational databases, which store data in tables, rows (representing database entries), and columns (for those entries' attributes). For example, an e-commerce website that manages its inventory in a database would store its products in a table — each product as a row and information about each product, like price, size, and color, as columns. When you view an item's webpage, the web server uses a scripting language like PHP to make one or more SQL queries to retrieve that product's information, then includes the results in the HTML page. If that product's price changes in the database, that new information will appear the next time you load that webpage.
The most common SQL command is SELECT, which retrieves information from a table. It can pull all the information in a table, or only records that meet certain criteria. For example, the following query retrieves all customer records from the specified ZIP code.
SELECT * FROM Customers WHERE Zip='55400';
The query below fetches the price of a particular product:
SELECT Price FROM Products WHERE ProductID=47988;
The UPDATE command changes the information stored in a specified table, row, and column. INSERT INTO creates new records, while DELETE FROM removes a record.
NOTE: If a website's developer does not properly validate user input and control access to their databases, it may be vulnerable to an SQL injection attack. An SQL injection allows an attacker to send malicious SQL statements to a database that would normally not be allowed — for example, retrieving a full list of customer names, addresses, and credit card numbers.