The Structured Query Language (SQL) comprises one of the fundamental building blocks of modern database architecture. SQL defines the methods used to create and manipulate relational databases on all major platforms. At first glance, the language may seem intimidating and complex but it&#39;s really not all that bad. In a series of articles over the next few weeks we&#39;ll explore the inner workings of SQL together. By the time we&#39;re through, you&#39;ll have the fundamental knowledge you need to go out there and start working with databases!<br/><br/>This week, our first article in the SQL series provides an introduction to the basic concepts behind SQL and we&#39;ll take a brief look at some of the main commands used to create and modify databases. Throughout this article, please keep our goal in mind: we&#39;re trying to get the &#34;big picture&#34; of SQL -- not a mastery of the individual commands. We&#39;ll provide a few examples for illustrative purposes and explain the theory behind them, but don&#39;t feel frustrated if you can&#39;t write your own SQL commands after reading this article. We&#39;ll cover each of the major commands in detail in future weekly installments. If you&#39;d like a reminder in your e-mail inbox each week when the next article is posted, please take a moment and subscribe to our newsletter.<br/><br/>By the way, the correct pronunciation of SQL is a contentious issue within the database community. In their SQL standard, the American National Standards Institute declared that the official pronunciation is &#34;es queue el.&#34; However, many database professionals have taken to the slang pronunciation &#34;sequel.&#34; The choice is yours.<br/><br/>SQL comes in many flavors. Oracle databases utilize their proprietary PL/SQL. Microsoft SQL Server makes use of Transact-SQL. However, all of these variations are based upon the industry standard ANSI SQL. In our tutorial series, we&#39;ll stick to ANSI-compliant SQL commands that will work on any modern relational database system.<br/><br/>SQL commands can be divided into two main sublanguages. The Data Definition Language (DDL) contains the commands used to create and destroy databases and database objects. After the database structure is defined with DDL, database administrators and users can utilize the Data Manipulation Language to insert, retrieve and modify the data contained within it. In the next two sections of this article, we&#39;ll explore DDL and DML in further detail. In future articles we&#39;ll take an in-depth look at specific SQL commands.<br/><br/>Now, let&#39;s take a look at the Data Definition Language. Read on!<p>The Data Definition Language (DDL) is used to create and destroy databases and database objects. These commands will primarily be used by database administrators during the setup and removal phases of a database project. Let&#39;s take a look at the structure and usage of four basic DDL commands:<br/><br/>The Data Definition Language (DDL) is used to create and destroy databases and database objects. These commands will primarily be used by database administrators during the setup and removal phases of a database project. Let&#39;s take a look at the structure and usage of four basic DDL commands:<br/><br/><b>CREATE</b><br/><br/>Installing a <a href="https://www.thoughtco.com/database-management-system-1019609" data-inlink="oMUOSFhT1ruucGhpADtx6g&#61;&#61;" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="1">database management system</a> (DBMS) on a computer allows you to create and manage many independent databases. For example, you may want to maintain a database of customer contacts for your sales department and a personnel database for your HR department. The CREATE command can be used to establish each of these databases on your platform. For example, the command:<br/><br/>CREATE DATABASE employees<br/><br/>creates an empty database named &#34;employees&#34; on your DBMS. After creating the database, your next step is to create tables that will contain data. (If this doesn&#39;t make sense, you might want to read the article Microsoft Access Fundamentals for an overview of tables and databases.) Another variant of the CREATE command can be used for this purpose. The command:<br/><br/>CREATE TABLE personal_info (first_name char(20) not null, last_name char(20) not null, employee_id int not null)<br/><br/>establishes a table titled &#34;personal_info&#34; in the current database. In our example, the table contains three attributes: first_name, last_name and employee_id. Don&#39;t worry about the other information included in the command -- we&#39;ll cover that in a future article.<br/><br/><b>USE</b><br/><br/>The USE command allows you to specify the database you wish to work with within your DBMS. For example, if we&#39;re currently working in the sales database and want to issue some commands that will affect the employees database, we would preface them with the following SQL command:<br/><br/>USE employees<br/><br/>It&#39;s important to always be conscious of the database you are working in before issuing SQL commands that manipulate data.<br/><br/><b>ALTER</b><br/><br/>Once you&#39;ve created a table within a database, you may wish to modify the definition of it. The ALTER command allows you to make changes to the structure of a table without deleting and recreating it. Take a look at the following command:<br/><br/>ALTER TABLE personal_info<br/>ADD salary money null<br/><br/>This example adds a new attribute to the personal_info table -- an employee&#39;s salary. The &#34;money&#34; argument specifies that an employee&#39;s salary will be stored using a dollars and cents format. Finally, the &#34;null&#34; keyword tells the database that it&#39;s OK for this field to contain no value for any given employee.<br/><br/><b>DROP </b><br/><br/>The final command of the Data Definition Language, DROP, allows us to remove entire database objects from our DBMS. For example, if we want to permanently remove the personal_info table that we created, we&#39;d use the following command:<br/><br/>DROP TABLE personal_info<br/><br/>Similarly, the command below would be used to remove the entire employees database:<br/><br/>DROP DATABASE employees<br/><br/>Use this command with care! Remember that the DROP command removes entire data structures from your database. If you want to remove individual records, use the DELETE command of the Data Manipulation Language.<br/><br/>That&#39;s the Data Definition Language in a nutshell. In the next section of this article, we&#39;ll take a look at how the Data Manipulation Language is used to manipulate the information contained within a database. Read on!</p>The Data Manipulation Language (DML) is used to retrieve, insert and modify database information. These commands will be used by all database users during the routine operation of the database. Let&#39;s take a brief look at the basic DML commands:<br/><br/>The Data Manipulation Language (DML) is used to retrieve, insert and modify database information. These commands will be used by all database users during the routine operation of the database. Let&#39;s take a brief look at the basic DML commands:<br/><br/><b>INSERT</b><br/><br/>The INSERT command in SQL is used to add records to an existing table. Returning to the personal_info example from the previous section, let&#39;s imagine that our HR department needs to add a new employee to their database. They could use a command similar to the one shown below:<br/><br/>INSERT INTO personal_info<br/>values(&#39;bart&#39;,&#39;simpson&#39;,12345,$45000)<br/><br/>Note that there are four values specified for the record. These correspond to the table attributes in the order they were defined: first_name, last_name, employee_id, and salary.<br/><br/><b>SELECT </b><br/><br/>The SELECT command is the most commonly used command in SQL. It allows database users to retrieve the specific information they desire from an operational database. Let&#39;s take a look at a few examples, again using the personal_info table from our employees database.<br/><br/>The command shown below retrieves all of the information contained within the personal_info table. Note that the asterisk is used as a wildcard in SQL. This literally means &#34;Select everything from the personal_info table.&#34;<br/><br/>SELECT *<br/>FROM personal_info<br/><br/>Alternatively, users may want to limit the attributes that are retrieved from the database. For example, the Human Resources department may require a list of the last names of all employees in the company. The following SQL command would retrieve only that information:<br/><br/>SELECT last_name<br/>FROM personal_info<br/><br/>Finally, the WHERE clause can be used to limit the records that are retrieved to those that meet specified criteria. The CEO might be interested in reviewing the personnel records of all highly paid employees. The following command retrieves all of the data contained within personal_info for records that have a salary value greater than $50,000:<br/><br/>SELECT *<br/>FROM personal_info<br/>WHERE salary &gt; $50000<br/><br/><b>UPDATE </b><br/><br/>The UPDATE command can be used to modify information contained within a table, either in bulk or individually. Each year, our company gives all employees a 3% cost-of-living increase in their salary. The following SQL command could be used to quickly apply this to all of the employees stored in the database:<br/><br/>UPDATE personal_info<br/>SET salary &#61; salary * 1.03<br/><br/>On the other hand, our new employee Bart Simpson has demonstrated performance above and beyond the call of duty. Management wishes to recognize his stellar accomplishments with a $5,000 raise. The WHERE clause could be used to single out Bart for this raise:<br/><br/>UPDATE personal_info<br/>SET salary &#61; salary &#43; $5000<br/>WHERE employee_id &#61; 12345<br/><br/><b>DELETE </b><br/><br/>Finally, let&#39;s take a look at the DELETE command. You&#39;ll find that the syntax of this command is similar to that of the other DML commands. Unfortunately, our latest corporate earnings report didn&#39;t quite meet expectations and poor Bart has been laid off. The DELETE command with a WHERE clause can be used to remove his record from the personal_info table:<br/><br/>DELETE FROM personal_info<br/>WHERE employee_id &#61; 12345<br/><br/>On the next page of this article, we&#39;ll begin exploring the power of JOINs. Read on!Now that you\u0092ve learned the basics of SQL, it\u0092s time to move on to one of the most powerful concepts the language has to offer \u0096 the JOIN statement. Quite simply, these statements allow you to combine data in multiple tables to quickly and efficiently process large quantities of data. These statements are where the true power of a database resides.<br/><br/>We\u0092ll first explore the use of a basic JOIN operation to combine data from two tables. In future installments, we\u0092ll explore the use of outer and inner joins to achieve added power.<br/><br/>We\u0092ll continue with our example using the PERSONAL_INFO table, but first we\u0092ll need to add an additional table to the mix. Let\u0092s assume we have a table called DISCIPLINARY_ACTION that was created with the following statement:<br/><br/>CREATE TABLE disciplinary_action (action_id int not null, employee_id int not null, comments char(500))<br/><br/>This table contains the results of disciplinary actions on company employees. You\u0092ll notice that it doesn\u0092t contain any information about the employee other than the employee number. It\u0092s then easy to imagine many scenarios where we might want to combine information from the DISCIPLINARY_ACTION and PERSONAL_INFO tables.<br/><br/>Assume we\u0092ve been tasked with creating a report that lists the disciplinary actions taken against all employees with a salary greater than $40,000. The use of a JOIN operation in this case is quite straightforward. We can retrieve this information using the following command:<br/><br/>SELECT personal_info.first_name, personal_info.last_name, disciplinary_action.comments<br/>FROM personal_info, disciplinary_action<br/>WHERE personal_info.employee_id &#61; disciplinary_action.employee_id<br/>AND personal_info.salary &gt; 40000<br/><br/>As you can see, we simply specified the two tables that we wished to join in the FROM clause and then included a statement in the WHERE clause to limit the results to records that had matching employee IDs and met our criteria of a salary greater than $40,000.<br/><br/>Congratulations! You&#39;ve learned the basic concepts behind the Structured Query Language. Stay tuned for future articles that explore these commands in-depth.