What is a database? Databases take the stress out of finding information!
Why do we need them? An Excel Spreadsheet is a “flat file”, meaning it has a bunch of information over & over again, with no way to customize what you see or avoiding duplicate information.
How are they used? A relational database is a single database spread across multiple tables. Think of a database as a file cabinet and each drawer of the file cabinet as a table within the database
Please allow me to introduce you to a DATABASE!!! Even though a database looks like this when you see one in real life….
…this is a databasewithout its“makeup”! REALITYCHECK!
Activity #1: Introducing Databases Don’t be afraid by what you saw on the previous slide, because I totally make sense! So let’s get beyond my bad hair day & bloated appearance, & get to know the “real” me!
Walkthrough & Explanations
The previous slide showed the database design (tables & columns), now we will see the actual data contained in rows
What we just learned:
How to get the exact data you want to see wherever you want to see it
“SELECT * FROM Boyfriends = T-SQL (Language). You can ask for very specific information this way
Because of the relationships between the tables, you can get information from multiple tables using 1 question (query)
Writing T-SQL statements QUERY the database tables (ask them questions)
If you wanted to ask the same question many times, you can create a “View”, which just saves your question so you don’t have to type it again. The next time you run the View, you get that same question answered WITH UPDATED DATA!
Activity #2: Running a Query to Retrieve Specific Data , & Activity #3: Customizing a View Return to SQLEXPRESS, & in the same query window but on a blank line, type “SELECT * FROM WhoDatedWho WHERE GirlName = ‘Paris’ “ , then again press F5 to run the query
Now, to create a View: In the left column where the database objects are listed, scroll way down past the last table “WhoDatedWho” until you see a folder entitled “Views”. Right click, then select “New View”. In the “Add Table” dialogue box, select “WhoDatedWho”, click “Add”, then click “Close”
You now have access to the “WhoDatedWho” table so you can select columns from it to make your View. Click the “GirlName” column, then finish the query so that it says “SELECT GirlName FROM dbo.WhoDatedWho WHERE (GirlName = ‘Paris’)
Click the Menu Item “File”, then click “SavexxxxxxView#”. You will then be prompted to choose a name for the View. I named mine “HowManyMenHaveDatedParisHilton”, but you can name it whatever you please!
You now have created a VIEW! You are now a coding hero! For YOU!!!!!!
What we just learned:
Why would I want to be a Database Developer? How would I know if I’d like database programming?
Of all the types of programmers there are, database programmers make the most money!
That means more trips to the mall!
If you like things organized, you will LOVE database programming!
If you like details, you’ll LOVE database programming!
Resources for further database learning: http://codeplex.com/SqlServerSamples
Microsoft SQL Server Community & Samples
Site to download free editions of software, including SQLEXPRESS