Bookmark and Share

SQL - Databases

What's a Database? A SQL database is nothing more than an empty shell, like a vacant warehouse. It offers no real functionality whatsoever, but does provide a virtual space to store data. Data is stored inside of database objects called tables, and tables are the containers that actually hold specific types of data, such as numbers, files, strings, and dates.

Advertise on Tizag.com

A single database can house hundreds of tables containing more than 1,000 table columns each and they may be jam packed with relational data ready to be retrieved by SQL. Perhaps the greatest feature SQL offers is that it doesn't take much effort to rearrange your warehouse to meet your ever-growing business needs.

SQL - Creating a Database

Creating a database inside of SQL Express has its advantages. After launching Microsoft's SQL Server Management Studio Express application, simply right-clicking on the Databases folder of the Object Explorer gives you the option to create a New Database. After selecting the New Database... option, name your database "MyDatabase" and press "OK".

Create New Database Command

Name the New SQL Database Window

Now is the time to press the New Query button located toward the top of the screen, just above the Object Explorer pane.

New Query Button

Pressing this button offers an empty tab. All SQL query statements (code) that we will be exploring will be entered here and executed against the SQL Express database.

If you haven't yet created a new database, you may also create a database by typing the following SQL query statement into your new empty query tab, and then pressing the Execute button or striking the (F5) key.

SQL Create Database Query:

CREATE DATABASE MyDatabase;

After executing this query, SQL will notify you that your query has run successfully and that the database was created successfully. If you receive an error message instead, Google the error message for troubleshooting advice. (Vista users must verify that they are running SQL Server Management Studio Express with administrator privileges.)

Congratulations! You have executed your first SQL command and written what is perhaps your first bit of SQL code.

Bookmark and Share




Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials