Computer Science
What is SQL
SQL, or Structured Query Language, is a domain-specific language used for managing and manipulating relational databases. It allows users to retrieve, insert, update, and delete data from databases. SQL is essential for interacting with databases and is widely used in software development, data analysis, and other fields that involve working with structured data.
Written by Perlego with AI-assistance
Related key terms
1 of 5
12 Key excerpts on "What is SQL"
- eBook - ePub
- Gavin Powell(Author)
- 2020(Publication Date)
- CRC Press(Publisher)
This chapter shows how the relational database model is used from an application perspective. There is little point in understanding something such as relational database modeling without seeing it applied in some way, and so this chapter looks at how a database model is accessed by applications. A relational database model contains tables, where rows in tables are accessed using a computer programming language called Structured Query Language (SQL). SQL is a declarative programming language that is used to read data from tables and update data in those tables.A declarative programming language describes what you are coding without describing how the problem is solved, which can be difficult to understand, because declarative code requires all instructions in a single complex instruction. Other computer programming languages such as C and FORTRAN are procedural or modular and break software down into separate parts called modules; and then there is Java, which is object-oriented.When a database model is well designed, the creation of SQL code can be a simpler process, which also can imply that difficulties encountered in coding of SQL queries can often indicate database model design flaws, or just too much granularity in a data model.This chapter covers:• What SQL is • The origins of SQL • Different types of queries • Changing data in tables • Changing table structureSQL is a declarative computer programming language used for accessing row and column values in relational database tables:4.1 What is SQL?
• SQL is structured in the sense that it is used to access structured data from tables in a relational database. • Use of the word “language” implies a computer programming language that has specific syntax for performing specific tasks.• SQL is a declarative language consisting of single commands where the database itself does a lot of the work in deciding how to get that information. In other words, SQL tells the database what it wants, and the database does some of the logical assessment, because logic is built into a relational database using keys and relationships between tables. A procedural language, on the other hand, contains blocks of commands, where those blocks of commands are sequences of distinct steps, typically where each successive step is dependent on the result of the previous step (command) in the sequence. - eBook - PDF
Database
Principles Programming Performance
- Patrick O'Neil(Author)
- 2014(Publication Date)
- Morgan Kaufmann(Publisher)
Query Language SQL This chapter introduces the database language known as SQL, a language that allows us to query and manipulate data on computerized relational database systems. SQL is the lingua franca for most database products cur-rently available, and it is of fundamental importance for many of the con-cepts presented in this text. ^ ^ ^ | Introduction We begin with an overview of SQL capabilities, then we explain something about the multiple SQL standards and dialects and how we will deal with these in our presentation. SQL Capabilities In Chapter 2 we saw how relational algebra queries could be constructed to answer English-language requests for information about a database. In Chapter 3 we will learn how to pose comparable queries in SQL, using a form known as the Select statement. As we will see, the SQL Select state-ment offers more flexibility in a number of ways than relational algebra for posing queries. However, there is no fundamental improvement in power, nothing that couldn't be achieved in relational algebra, given a few well-considered extensions. For this reason, experience with relational algebra Chapter 3 QUERY L A N G U A G E SQL 90 gives us a good idea of what can be accomplished in SQL. At the same time, SQL and relational algebra have quite different conceptual models in a number of respects, and it is hoped that the insight drawn from familiar-ity with the relational algebra approach will enhance your understanding of SQL capabilities. The most important new feature you will encounter with SQL is the ability to pose queries interactively in a computerized environment. The SQL Select statement is more complicated and difficult to master than the relatively simple relational algebra, but you should never feel lost or uncer-tain as long as you have access to computer facilities where experimenta-tion can clear up uncertainties about SQL use. - Nong Ye, Teresa Wu(Authors)
- 2014(Publication Date)
- CRC Press(Publisher)
151 8 Structured Query Language Structured query language (SQL) is the most influential query language of relational data-bases. This chapter first reviews the background of SQL followed by a brief discussion on Backus–Naur form (BNF) and extended BNF (EBNF), a main notation technique used in illustrating SQL syntax. The basic SQL statements, including CREATE, UPDATE, DELETE, and QUERY data, are then explained with examples. 8.1 Introduction to SQL SQL was initially developed by IBM as a part of the System R project in the early 1970s and was named structured English query language (SEQUEL). Later, it evolved to today’s acronym: SQL. In 1986, the American National Standards Institute first pub-lished the SQL standard, called “SQL-86,” followed by the International Organization for Standardization (ISO) in 1987. Since then, SQL has been enhanced several times. The first major revision was released in 1992, known as “SQL2” or “SQL-92,” which greatly enhanced the standard specification. The SQL syntax discussed in this chapter follows the SQL2 standard. SQL3 was released with support for object-oriented data manage-ment in 1999. In 2003, extensible markup language (XML)-related features were first introduced into SQL, resulted into version SQL-2003. As of today, there are seven revi-sions, and the most recent one is SQL-2011 (ISO 9075:2011), which was formally adopted in December 2011. According to the SQL standard, SQL is composed of five main languages: • Data definition language (DDL) . DDL is used to create and modify the relation sche-mas within a database. Example commands are the CREATE, ALTER, and DROP statements. • Data manipulation language (DML) . DML is used to retrieve, store, modify, delete, insert, and update data in the database. Examples of this are the SELECT, UPDATE, and INSERT statements. • Data control language (DCL) . DCL is used to create roles, permissions, and referen-tial integrity constraints for a database.- eBook - PDF
- Mark L. Gillenson(Author)
- 2012(Publication Date)
- Wiley(Publisher)
Data definition, which is operationalized with a data definition language (DDL), involves instructing the DBMS software on what tables will be in the database, what attributes will be in the tables, which attributes will be indexed, and so forth. Data manipulation refers to the four basic operations that can and must be performed on data stored in any DBMS (or in any other data storage arrangement, for that matter): data retrieval, data update, insertion of new records, and deletion of existing records. Data manipulation requires a special language with which users can communicate data manipulation commands to the DBMS. Indeed, as a class, these are known as data manipulation languages (DMLs). A standard language for data management in relational databases, known as Structured Query Language or SQL, was developed in the early 1980s. SQL incorporates both DDL and DML features. It was derived from an early IBM research project in relational databases called ‘‘System R.’’ SQL has long since been declared a standard by the American National Standards Institute (ANSI) and by the International Standards Organization (ISO). Indeed, several versions of the standards have been issued over the years. Using the standards, many manufacturers have produced versions of SQL that are all quite similar, at least at the level at which we will look at SQL in this book. These SQL versions are found in such mainstream DBMSs as DB2, Oracle, MS Access, Informix, and others. SQL in its various imple- mentations is used very heavily in practice today by companies and organizations of every description, Advance Auto Parts being one of countless examples. SQL is a comprehensive database management language. The most interesting aspect of SQL and the aspect that we want to explore in this chapter is its rich data retrieval capability. - Mark L. Gillenson, Paulraj Ponniah, Alex Kriegel, Boris M. Trukhnov, Allen G. Taylor, Gavin Powell, Frank Miller(Authors)
- 2012(Publication Date)
- Wiley(Publisher)
You will learn about basic language components through simple command exam- ples. The chapter introduces representative DDL and DML command statements through the standard command syntax and gives some insight into how some DBMS providers have modified these statements to meet their particular needs and design visions. 6.1 Introducing the SQL Language There are two aspects of data management: data definition and data manipula- tion. Data definition requires a data definition language (DDL) that instructs the DBMS software as to what tables will be in the database, what attributes will be in the tables, which attributes will be indexed, and so forth. Data manipula- tion refers to the four basic operations performed on data stored in any DBMS: data retrieval, data update, insertion of new records, and deletion of existing records. Data manipulation requires a special language with which users can communicate data manipulation commands to the DBMS. As a class, these com- mands are known as data manipulation language (DML). Data retrieval state- ments are sometimes placed in a different category, separate from DML, as data query language (DQL) statements. For the purposes of this chapter, retrieval statements are treated as part of the DML set. The current relational database management system language, Structured Query Language (SQL), was developed in the early 1980s and incorporates both DDL and DML features. SQL has been declared a standard by the American National Standards Institute (ANSI) and by the International Organization for Standardization (ISO), with several standard versions issued since its initial development. Many manufacturers have produced versions of SQL, most quite similar, including mainstream DBMSs such as DB2, Oracle, MySQL, Informix, and Microsoft SQL Server. 6.1.1 Understanding SQL Features The SQL standard defines the features supported by “standard” SQL implemen- tations. Most vendor implementations, however, go beyond the SQL standard.- eBook - PDF
- Paul Wilton, John Colby(Authors)
- 2005(Publication Date)
- Wrox(Publisher)
You need to write programming code to put inside a stand-alone application that the user runs on their computer, or you could set up a Web page to extract data. You’re not restricted to certain languages, so long as the language allows you to hook into the database management software. You can buy any number of different relational database management systems off the shelf, but this book’s aim is to present SQL that is standards compliant (more on the standards in the next section) and that works with as wide a range of RDBMSs as possible. However, there are times when the standards don’t allow you to do what you want. Other times, you may find that the various DBMS vendors haven’t implemented them consistently. This book provides details specific to MS Access, MS SQL Server 2000, IBM DB2, MySQL, and Oracle 10. Structured Query Language (SQL) The first questions to ask are What is SQL and how do you use it with databases? SQL has three main roles: ❑ Creating a database and defining its structure ❑ Querying the database to obtain the data necessary to answer questions ❑ Controlling database security Defining database structure includes creating new database tables and fields, setting up rules for data entry, and so on, which is expressed by a SQL sublanguage called Data Control Language (DCL), covered later in this chapter. The next section discusses querying the database. Finally, DCL deals with database security. Generally, database security is something that database administrators handle. Creating SQL every time you want to change the database structure or security sounds like hard work, and it is! Most modern database systems allow you to execute changes via a user-friendly interface without a single line of SQL. Introducing SQL Queries SQL queries are the most common use of SQL. A SQL sublanguage called Data Manipulation Language (DML) deals with queries and data manipulation. SQL allows you to pose a query (basically a question) 11 Introduction to SQL - S Krishna(Author)
- 1992(Publication Date)
- WSPC(Publisher)
SQL was the product of a major research and development project undertaken by IBM to implement a relational database system. The database management system to emerge out of this effort was known as System R. The commercial products which 4.1 SQL 69 followed are known as DB2 and SQL/DS. With its emergence as a stand-ard, SQL is available on practically all hardware and software platforms. Several DBMS packages (INGRES, dBASEIV etc.) whose principal inter-face is different, also provide an SQL interface. SQL incorporates all aspects of database creation, interaction and management. Our concern here will be mainly with the features for data retrieval or querying. The SQL term for a relation is a table. An attribute is a column (or a field) and a tuple is a row (or a record). A query as expressed in SQL can ask for values for one or more columns in one or more tables which satisfy a set of conditions. A query has basically a very simple syntax of the form SELECT .... FROM .... WHERE... The general form of the query with the optional clauses indicated by [...] is: SELECT [ALL/DISTINCT] columnname(s) FROM table(s) [WHERE predicate(s)][GROUP BY field(s)] [HAVING predicate] [ORDER BY column_name(s)] The following preliminary remarks concern the use of table names and column names in queries. 1. Range variables: A range variable may be associated with each table. Use of range variables is optional and may be dispensed with in most cases. When table names are long, use of range variables rather than full table names could shorten expression of search conditions. Range variables, however, are necessary when a table has to be present in more than one operand position. In Q8 below, for example, we need the join of a table with itself. This is the only example in which range variables are neces-sary, in the examples in this chapter. 2. Qualifying column names: Column names may be qualified with the name of the table (or range variable) to which they belong, together with a .- eBook - PDF
Understanding Databases
Concepts and Practice
- Suzanne W. Dietrich(Author)
- 2021(Publication Date)
- Wiley(Publisher)
6 SQL: Beyond the Query Language LEARNING OBJECTIVES • To define a relational database schema in SQL satisfying the constraints of the design • To learn how to manipulate data using insert, update, and delete • To understand fundamental data security using privileges Although SQL is short for Structured Query Language, the SQL standard has evolved to include much more than just the query language. There is a data definition language for defining tables and associated constraints on the table and its attributes, including referential integrity. There is also a data manipulation language for inserting, updating, and deleting tuples from tables. In addi- tion, there are language components for defining data access privileges. This chapter highlights these features of a relational database. It is important to note that every database product is an approximation to the SQL standard. When you use a particular database product, it is important to look up the specific syntax it supports. 6.1 Data Definition Chapter 1 introduced the relational data model as a collection of relations. A relation’s schema refers to its description, indicating the attributes in the relation. A visual schema of the database includes the tables with their attributes along with yellow gold keys to indicate primary keys and orange keys to denote foreign keys linked to their associated primary keys, illustrating the referential integrity relationship between the tables. Textually, a summary syntax for a relational schema provides the table name with a list of its attributes enclosed in parentheses, underlining the attributes that form the primary key of the table. The SQL DDL specifies the syntax to create, drop, and alter tables. The SQL standard provides a sublanguage for defining a database, called a data definition lan- guage (DDL). There is a create table statement to define the table attributes with the associated types and constraints, along with any constraints that apply at the table level. - eBook - ePub
RDBMS In-Depth
Mastering SQL and PL/SQL Concepts, Database Design, ACID Transactions, and Practice Real Implementation of RDBM (English Edition)
- Dr. Madhavi Vaidya(Author)
- 2021(Publication Date)
- BPB Publications(Publisher)
HAPTER 3Relational Query Languages
Introduction
This chapter introduces the readers to the Structured Query Language or SEQUEL. Structured Query Language is a set of commands, which is used for interacting with relational databases. SQL is used for a vast range of purposes, including data warehousing, e-commerce, and many more applications as backend.SQL is a query language that is used to retrieve and send information, and organize information in a database. SQL is widely used in business, and in other types of database administration. It allows to write various types of queries like pattern matching or using the logical or relational operators. Finally, towards the end of the chapter we will learn the data dictionaries in SQL, and how to create the constraints and to name them.Structure
- Introduction to SQL
- SQL datatypes
- Components of SQL
- Relational and Logical operators
- Range operators (In, Between, Like, NULL Predicate)
- Clauses (Distinct, where)
- Constraints
- Implementation of constraints in SQL
- Integrity constraints
- Referential integrity constraints
- Business constraints
- Understanding data dictionary
Objectives
After studying this unit, you should be able to:- Understand SEQUEL or SQL, and its importance
- Know the various datatypes used in SQL
- Find and execute various operators
- Understand the rage operators and various clauses
- Know the use of various types of constraints and their role in SQL
- Understand the concept of data dictionary
In the last chapter, we were introduced to the various operators and their use in RDBMS. In addition to it, we learnt an important concept of ER model and the need of such design approach for database designing.Finally, we understood what is normalization. We will learn the various forms of normalization in later chapters. This chapter is focused on learning the SEQUEL or SQL, which is very important to understand backend and the usage of SQL queries. - eBook - PDF
Advanced SQL:1999
Understanding Object-Relational and Other Advanced Features
- Jim Melton(Author)
- 2002(Publication Date)
- Morgan Kaufmann(Publisher)
Many books and articles define SQL by parenthetically claiming that the letters stand for Structured Query Language. While this was true for the original prototypes, it is not true of the standard. When the letters appear in product names, they have often been assigned this meaning by the product vendors, but we believe that users are ill- served by claims that the word structured accurately describes the language over- all. I've heard recent claims that the letters stand for Standard QueryLanguage, but that's at best a myth. The letters are not an abbreviation or an acronym, merely the result of the evolution from the name used in early research projects. If you really need the name to be an acronym, I suggest that it could simply stand for 1 Jim Melton and Alan R. Simon, SQL:1999:Understanding RelationalLanguageComponents (San Francisco: Morgan Kaufmann Publishers, 2001). 1.2 What is SQL? 3 SQL Query Language, one of those recursive acronyms (another is GNU, which I'm told is an acronym for GNU's Not Unix). The 1999 edition of the SQL standard introduces many significant new fea- tures into the language, but the most eagerly awaited enhancement is the addi- tion of user-defined type support, often considered to provide object-oriented SQL capabilities. The largest fraction of this volume addresses those new features. 1.2.1 SQL Versus Object-Oriented Database Systems The rigidity of the relational model with its mathematical underpinnings (dis- cussed in Volume 1) made it impossible to include complex user-defined data types, methods, encapsulation, and all the other aspects of object orientation 2 . .. right? Not exactly, as it turned out. As time slipped away from the 1970 publication of Dr. - eBook - ePub
- Bryan Newsome(Author)
- 2012(Publication Date)
- Wrox(Publisher)
The database engine, in your case Microsoft SQL Server 2012, manages the file or files and the data within those files. The database format is known as a relational database. At its most basic level, data is stored in tables, rows, and columns similar to how you see data in a spreadsheet. The data in tables is related by special database keys, which allows for better storage and faster retrieval. To access the data, you will use Structured Query Language (SQL). After you complete this chapter, you'll understand all this information. Database Tables A table contains a collection of data, which is represented by one or more columns and one or more rows of data. Imagine the way data is stored in a spreadsheet in rows and columns. Each column in a table represents an attribute of the data stored in that table. For example, a column named First Name would represent the first name of an employee or customer. This column is an attribute of an employee or customer. A row in a table contains a collection of columns that form a complete set of attributes of one instance of the data stored in that table. For example, suppose a table contains two columns: First Name and Last Name. These two columns in a single record describe the name of that one person. This is illustrated in Figure 15.1. Figure 15.1 Try It Out: Creating Tables In this Try It Out, you use SQL Server Management Studio (SSMS) to create a database and add a table. Note SQL Server Management Studio is a tool you use to help manage SQL Server Databases. As a developer, you may or may not have access to your company's SQL Server databases. If you are allowed to access them, this is the best tool to use. It allows you to create and change databases you are using in your applications as well as to create and test SQL statements you will use in your application. There are many other features this application can do for you to help manage your databases that you will not use in this book - eBook - ePub
- Bryan Newsome(Author)
- 2015(Publication Date)
- Wrox(Publisher)
The database engine, in your case Microsoft SQL Server 2014, manages the file or files and the data within those files. The database format is known as a relational database. At its most basic level, data is stored in tables, rows, and columns similar to how you see data in a spreadsheet. The data in tables is related by special database keys, which allows for better storage and faster retrieval. To access the data, you will use Structured Query Language (SQL). After you complete this chapter, you’ll understand all this information. Database Tables A table contains a collection of data, which is represented by one or more columns and one or more rows of data. Imagine the way data is stored in a spreadsheet in rows and columns. Each column in a table represents an attribute of the data stored in that table. For example, a column named First Name would represent the first name of an employee or customer. This column is an attribute of an employee or customer. A row in a table contains a collection of columns that form a complete set of attributes of one instance of the data stored in that table. For example, suppose a table contains two columns: First Name and Last Name. These two columns in a single record describe the name of that one person. This is illustrated in Figure 12.1. FIGURE 12.1 TRY IT OUT Creating Tables In this Try It Out, you use SQL Server Management Studio (SSMS) to create a database and add a table. NOTE SQL Server Management Studio is a tool you use to help manage SQL Server Databases. As a developer, you may or may not have access to your company’s SQL Server databases. If you are allowed to access them, this is the best tool to use. It enables you to create and change databases you are using in your applications, as well as to create and test SQL statements you will use in your application. There are many other features this application can do for you to help manage your databases that you will not use in this book
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.











