Skip to content

Four Myths about SQL

July 17, 2017







Some people may decide not to learn SQL because of something they may have heard, or just assumed, that is completely untrue. Myths such as these can stand in the way of people moving ahead in their careers. There are number of these myths that hold people back, but I would like to discuss just four of them.

  1. 1. SQL is a programming language and I am not a programmer. Although SQL is a language, it is not a programming language in the way you are probably thinking. Most computer languages are procedural languages. To use them, a programmer creates a procedure in which a series of instructions are written in a step-by-step manner to cause a computer to perform some action. The programmer must understand what is going on at a deep level in order to generate the correct sequence of instructions.


SQL is not like that. It is not a procedural language. It is called a non-procedural language because there is no need to write a procedure. With SQL all you need to do is write a statement that tells the computer what action you want it to perform. The DBMS figures out the details of how to do that, then goes ahead and does it.

  1. Knowing SQL would be of no value to me since I don’t have a programming job. Although it is true that information technology professionals have the most to do with databases, these days practically everyone in an organization has some exposure to them and may need information contained in them in order to do their jobs. You may not work with a database every day, but occasions will arise when you will need a fact contained in a database and there is no IT professional available to obtain it for you. Anyway, you should be able to perform basic database retrieval operations for yourself. It makes you a more valuable employee.
  2. You need to be some kind of brainiac to understand SQL. There is a mystique surrounding computers in general and SQL in particular that they are beyond the comprehension of ordinary people. This is particularly untrue about SQL, which consists of simple statements that are very similar to ordinary English-language sentences. If you can compose and write down a sentence, you could just as easily write an SQL statement that would perform a query.
  3. Knowing SQL won’t be of any value to me. This is the biggest myth of all. Our world today is totally dependent upon computers and the data stored within them. A lot of jobs will become obsolete and disappear within the next ten years, but jobs associated with information technology will not be among them. Learning SQL could be one of the most effective things that you could do to guarantee your future employability.

Retrieving Data with Simple SELECT Statements

July 17, 2017







Some things that you may want to retrieve from a database can be very easy to obtain with an SQL statement. Other questions might be more involved, and correspondingly require a rather complex SQL statement. Much like English-language sentences, SQL statements can contain multiple clauses that serve to precisely filter out all the data you don’t want, leaving only the information you do want, in the form that you want to see it.

Let’s look at a very simple retrieval operation to answer a simple question, and proceed from there to add clauses to SQL SELECT statements to home in on more tightly targeted questions.

For anyone working for a business or even a non-profit entity, it is probably important that you know as much about your existing customers as possible, so that you can find new customers with similar needs. You can delve into your database’s tables to find out more about your customers and what they have bought in the past. Let’s look at how we could do this with SQL..

After launching your DBMS, connect to a database that contains the information of interest. Take a look at the list of tables included in the database. Suppose one of them is named ‘customer.’

Perhaps the first thing you want to know is the number of customers you have in your customers table. You can answer this question with a simple SELECT statement. Go to the blank window that your DBMS provides, into which you can type SQL statements.

In the window, type:

SELECT * FROM customers ;

The asterisk is a wildcard character that means “all columns.” This will cause the data in all the columns of the customers table to be returned. The semi-colon denotes the end of the statement.

To execute the statement, There should be an icon or button that you can click. Once you click it, your statement will be executed and the result of the operation will be displayed. Along with a list of all the fields in all the rows of your database, there will probably also be a message telling you how many rows have been returned.

Since all you wanted was the number of customers, not a display of all the data for all those customers, there is another way to answer your question, with the statement:

SELECT COUNT (*) FROM customers ;

That returns the number of rows in the customers table..

It’s nice to know how many customers you have, but more useful from a marketing perspective might be to know how many customers you have in a particular region that you could target with advertising. Suppose you want to know how many customers you have in California, for example. A small addition to your original SELECT statement will do the trick. Type:

SELECT * FROM customers

WHERE state = ‘CA’ ;

The WHERE clause returns only those rows where the value in the state column is CA. Text strings such as CA must be enclosed in quote marks for the database engine to understand that it is looking at a text string.

Earlier, we used COUNT to count the number of customers in the customers table COUNT is an example of a Set function. Other set functions are: MAX, MIN, SUM, and AVG. As you would expect, MAX will return the maximum value that exists in the specified column, MIN will return the minimum, SUM will add up all the values, and AVG will return the average value.

Suppose we want to know the total of all the sales recorded in the invoices table of the database. I bet you could figure out what the SQL for that would be. It would be:

SELECT SUM(Total) FROM invoices ;

Execute that statement and you receive the total amount of sales that have been made.

More likely, you are interested in the total sales during an interval of time, for example a month. We can obtain this information by adding a WHERE clause to our statement.

SELECT SUM(Total) FROM invoices

WHERE InvoiceDate > ‘2017-01-31’ AND InvoiceDate < ‘2017-03-01’ ;

This gives us the total sales for the month of February 2017. The AND keyword is a logical connective that enables us to express a compound condition. It only returns rows where both the predicate before the AND keyword and the predicate after the AND keyword are true. A predicate is a statement that may either be logically True or logically False. A date is either greater than February first 2017 or it is not.

Other logical connectives are OR and NOT, although NOT does not connect two predicates. A predicate preceded by a NOT keyword evaluates to True if the predicate itself evaluates to False. A clause with an OR connective is considered to be true if either of the two predicates in contains, evaluates to a true value.



5 Reasons Why You Need SQL

July 17, 2017

There are a number of reasons why it makes sense to gain a working knowledge of SQL. Here are the top five benefits:

  1. Scalability–SQL is the language used by relational databases, and is used throughout the world in both proprietary and open source databases and its syntax is controlled by an international standard. Once you learn the SQL language, you can successfully use it with any relational database.
  2. Enhanced job skills–Because it is so widely used, knowledge of SQL is a highly sought after job skill by recruiters for any computer-related job. Not just programming or systems analyst jobs, but many other jobs that deal with the data stored in databases.
  3. Quick–SQL gives you the ability to retrieve the information you want from a database quickly and easily with simple English-like statements. No programming required. Retrieving answers quickly will make you more valuable to any organization.
  4. Better decision making–Understanding how the technology in your office works is valuable. The more you know, the better your decisions.
  5. Logical--Aside from all the “practical” reasons for learning it, SQL is intuitive and logical, and thus fun to use.


Why Might You Want to Learn How to Query a Database?

July 12, 2017

Databases are everywhere today. They serve as the back ends of Web sites, and store the most critical information belonging to organizations of all sizes. The information held in an organization’s databases is often that organization’s most valuable asset. However, organizations can only take advantage of that value if people have the ability to retrieve the data they need.

Generally, when a new database is installed, application programs are written that are designed to answer specific questions. As time goes on, it becomes clear that the data in the database could be used in ways not envisioned when it was first put into operation. Existing applications do not address these possible new uses. Changing or completely rewriting application programs calls for skilled programmers, and is almost always a lengthy process.

To answer a question that has recently arisen, it makes much more sense to get the answer right away by writing an SQL query. This does not require any programming skills, and can provide the needed answer right away.

People working for, or wanting to work for, an organization that has one or more databases, have added value if beyond their other job skills, they can also formulate and run SQL database queries. Most questions that an organization might want to ask can be answered with a single well-crafted SQL statement. Learning how to craft such queries makes people more valuable to their organization and thus enhances their career prospects.

Getting Closer to Digital Immortality

December 16, 2016

After his father’s death, Ray Kurzweil started collecting every scrap of information about his father that he could. He wanted his father back, and believed that the day would come when artificial intelligence, if supplied with enough information about a person, could produce a high-fidelity virtual replica of that person. Kurzweil has saved all that collected information against that day. That day may not be as far off as you might think, based on what some startup companies are doing even now. NBC News reports on the current state of the efforts.

US Election Assistance Commission Hacked

December 16, 2016

As reported by the reputable Reuters news agency, a Russian-speaking hacker penetrated the USEAC and stole login credentials of officials of the Commission. The intent was to sell them to a foreign government for cash. The hacker used a SQL injection attack to penetrate the credentials database. This kind of crime is a danger to everyone, including those who never touch a computer. If anyone you know touches a computer, you are at risk too, through them.

Learn more by requesting my free SQL Injection Attack Primer.


My Latest Book

December 1, 2016

My latest book, “Develop Microsoft HoloLens Apps Now” is available for a limited time at a 30% discount, direct from the publisher. Go to, enter the title, and use discount code TAYLOR30.