Why should you study SQL (Structured Query Language)? It's the most extensively used data manipulation language, for one simple reason. It is used on a daily basis by database administrators and application developers to store and retrieve data. It can be used for reporting and analysis by non-technical employees as well. SQL is required knowledge for everyone with access to databases or reporting tools. In addition, having a solid understanding of SQL looks good on a résumé.
You won't just read about SQL in this lesson; you'll actually develop and run SQL queries on your own computer. Don't worry, it'll be simple. To install the required software, you'll need an internet connection and enough hard disk space (not much). The SQL Server Express Edition from Microsoft will be used in this lesson. SQL Server is a popular database tool nowadays. The free Express Edition has sufficient features to get anyone started with SQL. It's most likely the greatest place to begin. To begin, type "SQL Server Express 2008 Download" into a search engine to download SQL Server Express Edition to your computer (follow the on-screen instructions).
Locate the file on your computer and double-click it after it has finished downloading. This begins the installation process. If you're instructed to launch the file, go ahead and do so. Several screens will appear and disappear until the SQL Installation Center appears. Select "new installation" from the drop-down menu and proceed through the windows that display. When prompted, type in a name for your instance. A user name and password will be required on one screen. Use your regular login details together with "Windows Authentication" for the purposes of this tutorial. Regrettably, the installation procedure necessitates waiting. Grab a bite to eat or go for a walk around the block. If a problem occurs during installation, look for a solution by typing the error message into a search engine. You'll get a "complete" screen when the installation is finished.
You're almost there with writing genuine SQL. In the Microsoft SQL Server folder of your start menu programs, locate and open the program "SQL Server Management Studio." Management Studio (sometimes known as "SSMS") is a tool for composing SQL statements. When the application first starts up, it will ask you for a server name. Make sure the "Authentication" box reads "Windows Authentication" and use the name you specified in the "instance name" during installation. Then select "connect" from the drop-down menu.
You've arrived to the Management Studio's main screen. In the "Object Explorer" window, you should see the name of your instance and potentially a lot of empty space. At this moment, you're missing one crucial component, the most crucial of all: data. To write SQL, you must first load data. You're probably asking where to collect data because most people don't have any on hand.
Click to obtain an installation file for the relevant sample database package (most likely SQL Server 2008R2 or SQL Server 2008, depending on the version you installed). Locate the executable file you just downloaded and double-click it to install the sample database. Follow the onscreen prompts and select the same instance name as when you installed it. Your database should now be full of information. Verify this by going to Management Studio's "Object Explorer" and clicking on "Databases." A list of AdventureWorks databases should appear. We're now ready to start writing SQL.
Find and click the "new query" button in the upper left corner. This creates a new window where you can write SQL. Next, pick "AdventureWorks" from a drop down box directly below the "new query" button (it should say "master"). This chooses the "AdventureWorks" database, and any SQL you create will be applied to it.
Now, in the wide blank space that appeared when you chose "new query," type your query. Finally, we'll create some SQL and look at some data. In the query window, type the following SQL statement:
Now press the "Execute" key (just above the left side of the query window). Columns of data should show directly beneath your query. You asked the database to return everything (or "*," which approximately translates to "everything") from the Sales.Individual table in your SQL statement. In your own database environment, you've now successfully typed SQL.
Let's have a look at another SQL example. What if you're not interested in seeing everything? In the query window, type the following:
When you select the "Execute" button this time, only two rows of data show. It should come as no surprise that these fields correspond to the SQL statement's two rows. You're looking at a portion of the data in this situation. SQL enables you to view whatever you want.
You're now ready to go on to the next step in your SQL education. Try searching for "SQL Tutorial" in any search engine to locate some free online tutorials. There are a lot of decent SQL books out there. Recommendations can be found by searching Amazon reviews. This will assist you in determining what to buy and what not to buy.
This little presentation only scratched the surface of SQL's capabilities. Don't come to a halt here. Continue to learn, and you'll soon be able to write outstanding SQL queries.