構造化クエリ言語(SQL)とは?
原題: What Is Structured Query Language (SQL)? | IBM
分析結果
- カテゴリ
- AI
- 重要度
- 66
- トレンドスコア
- 30
- 要約
- 構造化クエリ言語(SQL)は、データベース管理システムにおいてデータの操作や管理を行うための標準的なプログラミング言語です。SQLを使用することで、データの取得、挿入、更新、削除が可能となり、データベースの構造を定義することもできます。SQLは多くのデータベースシステムで広く利用されており、データ分析やアプリケーション開発において重要な役割を果たしています。
- キーワード
What Is Structured Query Language (SQL)? | IBM What is Structured Query Language (SQL)? Authors Alexandra Jonker Staff Editor IBM Think Tim Mucci IBM Writer Gather What is Structured Query Language? Structured Query Language (SQL) is a domain-specific, standardized programming language used to interact with relational database management systems (RDBMS) such as MySQL , SQL Server, IBM Db2, PostgreSQL and Oracle Database. SQL queries (also known as SQL commands or SQL statements) allow users to easily add, retrieve, update, delete, aggregate and otherwise manage data in a relational database (or SQL database). In these systems, structured data is ordered into rows and columns, which together form tables. Data is typically structured across multiple related tables that can be linked using primary or foreign keys. Unlike other programming languages, SQL is a declarative language, which means it describes what the user wants the computer to do rather than how to achieve it. This contrasts with imperative or procedural languages (such as Java and COBOL ) which require step-by-step instructions. For example, when users write an SQL query to fetch data, they don't need to outline the steps the database should take to gather that data; they just describe what the result should look like: SELECT name, email FROM customers WHERE city = 'New York' ; SQL is a fundamental and versatile tool in the modern tech stack, known for its data manipulation capabilities, rapid query processing and strong security features. It also offers compatibility across different systems, scalability to handle growing data needs and robust open source and community support. The history of SQL In the 1970s, IBM scientists Donald Chamberlin and Raymond Boyce developed and introduced SQL. It originated from the concept of relational models and was initially called structured English query language (SEQUEL) before being shortened to SQL. It became commercially available in 1979 and has since become the global standard for relational database management systems. SQL was standardized by the American National Standards Institute (ANSI) in 1986 and the International Organization for Standardization (ISO) in 1987. Despite being a standard, SQL has various dialects, such as T-SQL for Microsoft SQL Server and PL/SQL for Oracle Database. These SQL dialects meet specific system needs while remaining compliant with the core ANSI standard commands such as SELECT, UPDATE, DELETE, INSERT and WHERE. The latest tech news, backed by expert insights Stay up to date on the most important—and intriguing—industry trends on AI, automation, data and beyond with the Think newsletter. See the IBM Privacy Statement . Thank you! You are subscribed. Why is SQL important? Since its development in the 1970s, SQL has become the backbone of modern database systems. Unlike general-purpose programming languages, SQL is purpose-built for relational databases—and relational databases are, in turn, optimized for SQL. This mutual design renders SQL a highly efficient data management tool. SQL’s declarative nature makes it accessible even to users with limited programming experience, making it an ideal language for beginners. Its widespread use and integration with other programming languages like Python and Java also make it a valuable skill in broader programming and data environments. Data analysts, data scientists and database administrators regularly use SQL because it excels at tasks such as data processing, data definition, access control, data sharing , data integration and big data analytics . In data science , SQL is used to create databases that store large data sets needed for data analysis. Its ability to manipulate and retrieve data from these vast, structured datasets is also crucial in the development of artificial intelligence (AI) and machine learning (ML) applications, which depend on high-quality data for training. By adhering to ACID properties—atomicity, consistency, isolation and durability—SQL helps ensure reliable transaction processing for critical use cases and sensitive data handling. It also supports more accurate data-driven decision-making , advanced analytics and enhanced business intelligence . Learn SQL AI Academy Is data management the secret to generative AI? Explore why high-quality data is essential for the successful use of generative AI. Go to episode What are the advantages of using SQL? SQL offers many advantages, which is why it has remained one of the most widely used and enduring programming languages. Easy data manipulation SQL’s simple commands (such as GROUP BY, ORDER BY, GRANT and REVOKE) empower users of all skill levels to work with databases. Rapid query processing SQL indexes and query optimization techniques improve the speed of data retrieval, and subsequently, enhance database performance. Robust data security SQL databases include security features such as user authentication, access controls and encryption to protect data. Commonality and compatibility SQL adheres to ANSI and ISO SQL standards, which help ensure compatibility with various systems and platforms, including cloud environments and big data tools. Scalability SQL can effectively manage both small and large databases, adapting to growing data needs without significant performance loss. Open source support Many SQL databases are open source and supported by a large, active community that contributes to continuous improvement and problem-solving. How does a SQL query work? A relational database organizes data in a tabular format (rows and columns) and facilitates relationships between different tables. For instance, a customer service database might use separate tables for customer information, purchases, product codes and contacts, linked by keys like a unique customer ID. SQL allows users to write queries (and subqueries) to manipulate this data. These commands run through several software components during the SQL process: A parser verifies the correctness of SQL statements and converts them into a format that the database can understand, such as tokenized symbols. This step involves syntax analysis and semantic checking. The parser will also help ensure the user is authorized to perform the operation. Then, a relational engine —also known as a query optimizer—plans the most efficient data retrieval, modification or addition strategies. It does so by evaluating different query execution plans. It writes the plan in bytecode, which is a virtual machine language. This step is crucial for optimizing database performance and resource use. Finally, a storage engine processes the bytecode, runs the SQL statement and manages physical data storage . It handles the physical representation of data, including file formats and data buffering. It also returns the result to the user or app. This step helps ensure efficient data access and updates on the disk. This linkage often involves relationships, such as one-to-many or many-to-many, established using primary and foreign keys to help ensure data integrity. Key components of SQL systems Relational database management systems (also called SQL systems) consist of many components, including: Databases: A digital repository for storing, managing and securing organized collections of data. Database tables: Data formatted into rows and columns; each contains information on one type of entity. SQL queries: SQL queries are instructions written in SQL used to manipulate data within a relational database. SQL constraints: Rules that control data in database columns or tables to maintain data integrity . Stored procedures: SQL commands that are saved for continued reuse. Transactions: One or more SQL commands bundled as a single unit of work or operation. Data types: Rules that define the type of data that can be stored in a column. Indexes: A database object that speeds up data retrieval by reducing the number of disk accesses needed for a query. Views: Virtual tables based on SQL queries that simplify complex queries and improve security by restricting access to underlying data. Security and permissions : Functions to manage user access, while backup and recovery mechanisms protect data against loss or corruption. Types of SQL commands: DDL, DML, DQL, DCL, and TCL SQL commands are traditionally divided into the following categories: Data definition language (DDL) Data manipulation language (DML) Data control language (DCL) Data query language (DQL) Transaction control language (TCL) Data definition language (DDL) Data definition language manages database objects like tables, views and indexes. It defines the structure and organization of the stored data and the relationships among stored data items. Data manipulation language (DML) Data manipulation language manages data within databases through operations like INSERT, UPDATE and OUTER JOIN—which add, modify and combine data. Data control language (DCL) Data control language controls data access through commands like GRANT (to give permissions) and REVOKE (to remove permissions). It can restrict a user's ability to retrieve, add and modify data. Data query language (DQL) Data query language executes data queries to retrieve information, typically using the SELECT command. It can retrieve specific data items or a range of items. Transaction control language (TCL) Transaction control language manages transaction changes to help ensure data integrity and supports ROLLBACK and COMMIT operations for undoing or storing changes, respectively. It is used to coordinate data sharing by concurrent users. What are the most common SQL commands? SQL databases support various SQL statements for data operations. However, SQL commands can vary depending on the database, which may use its own SQL syntax. Basic SQL commands include: SELECT Retrieves data from one or more tables. SELECT name, email FROM customers WHERE city = 'New York' ; This statement retrieves the name and email of all customers who li