This tells the database that a statement has ended. At the end of a statement, we put a semi-colon. In this course, I'll follow the custom of writing them in uppercase, even though we have some syntax highlighting that will also help differentiate them. But it helps to distinguish the SQL from your expressions and field names at a glance. These keywords and operators are customarily written as uppercase, though usually they don't have to be. There are also operators, as we'll see later on, which let us compare equality or ranges of data or treat information in other ways. A clause can be a statement if you're writing a really basic one. Predicates include a value or condition called an expression. ![]() These clauses are constructed out of various elements including keywords, which are special or reserved words which tell the database to take some action, field names, which let us refer to fields or columns of data whose values we want to use, table names, which tell the database which table to use, and predicates, which we use to specify what information or condition we're looking for. Clauses are the basic components of statements, the smaller building blocks that make up the whole thing. We'll see how to make clauses on statements later in the course. Don't worry about what this actual statement does right now. I find it really helpful when I'm putting together a more complicated statement so I can see what's going on. In this course, I'll break statements across various lines in order to make them more clearly readable. SQL is generally white space independent, meaning that if you want to add some space or lines between clauses or expressions to make your statement easier to read, you can do so. Overall, something you write in SQL to get an answer from a database or to make a change to it is called a statement. Before we start building SQL statements, we need to understand what the basic parts of a statement are. Just don't call it squeal or squirrel or anything like that. Both ways are acceptable, though some people have strong opinions about it. I tend to prefer switching back and forth a little bit, calling the language itself by the letters and saying sequel when it's easier to pronounce that way, or when it flows better as part of the name of a product. This confusion extends to products with the name of the language in their names, like MySQL or MySQL or Microsoft SQL Server. Maybe because of this, or because the letters themselves look a little bit like the English word sequel, some people pronounce the name of the language this way instead. The language is called SQL, or Structured Query Language, but was originally called SEQUEL, for Structured English Query Language. The way we say the name of this language can sometimes be a little bit confusing. In this course, I'll cover the basic and widely supported parts of SQL that you're likely to use, whether you're working with Microsoft Transact-SQL or T-SQL, MySQL, Postgres, SQLite, and others. Some products support the SQL standard and add other features on top of it, and some support part, though not all, of the SQL standard. Because it's such a powerful way of thinking about data, SQL has been adopted into many database products. ![]() To make questions like this approachable for a database, we need to break them down into a series of smaller questions that are structured in a way that the database software can understand. The computer doesn't know how to understand the meaning or intention of my question. But give that same list to a database and ask the same question, and you'll probably get whatever the computer equivalent of a blank stare is. Even given just a list of team members, points, and shirt preferences, you could eventually figure it out. If I were to ask you a question like, "How many people on the winning team asked for shirts?", you, a person, could pretty easily understand what I'm asking you. Databases aren't clever and they can't figure out meaning from a question the way a human can. SQL gives us a way of writing questions a database can understand. And if you want to explore the academic history of SQL, I encourage you to do so. We'll focus on the practical usage of the language. There's a whole lot of formal math behind how SQL was designed and defined, but in this course, we're not going to cover that. SQL gives us a standardized way of asking a specific question of a database, or for making a structured query that a database knows how to respond to. ![]() It first came into use in 1974 and became a standard in 1986. SQL stands for Structured Query Language, which is a language for manipulating and defining data in databases.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |