HI, MY NAME IS KIM SCHMIDT & I AM A MICROSOFT CERTIFIED APPLICATION DEVELOPER. YOU CAN ASK ME ANY QUESTIONS YOU’D LIKE TO KNOW ABOUT ME TOMORROW EITHER DURING THE COLLEGE PREP SESSION OR THE JOB SHADOWING SESSION. LOOKING AT THE SCREEN, WHAT DO YOU THINK THIS CLASS IS ABOUT? DATABASES!!! __________________________________________________________________________________________________________________________________________________________________________________FIRST ROW:CHAD MICHEAL MURRAY “One Tree Hill, high school football star”LL COOL J “Singer, engaged to Beyonce”DAVID BECKHAM “Soccer Phemon, married to Posh Spice”JOE JONAS “The Jonas Brothers, singers”BRAD PITT “Actor, part of duo Bradgelina”SECOND ROW:JOHNNY DEPP “Actor…..”VIN DIESEL “Actor, XXX Movies” (not X-rated, movies entitled “Triple X”)MATTHEW CcCONAUGHEY “Actor”JAKE GYLLENHAAL “Actor, ‘Brokeback Mountain’”NICK JONAS “The Jonas Brothers, singers”DENZEL WASHINGTON “Actor”THIRD ROW:ZACH EFFRON “High School Musical”ANDY GARCIA “Oceans ‘whatever number’, Actor”P DIDDY “Singer”HOMER SIMPSON “TV & Movie Star”JOSHUA “Winner of ‘So You Can Dance’LEONARDO DICAPRIO “Actor, Titanic & more”MARC ANTHONY “Singer, married to JLo”
Here,you’re looking at a photo of a person dressed as Microsoft SQL Server Girl! If you haven’t noticed, (wherever she is mounted), is a real-sized Source Force Superhero, SQL Server Gal! These action heroes are Developer Superheroes who fight software problems just as normal Superheroes fight the bad guys! What I LOVE ABOUT SQL SERVER GAL IS SHE IS FEMALE!!! Now, when you leave this class today, you might not quite be a Database Superhero, but you will be empowered with the knowledge of what databases are, what they do & affect in everyday life, & realize that our world wouldn’t be the same without them.__________________________________________________________________________________________________________________________________________________
On the screen, you’ll see the topics we’re going to cover in this session:What is a database, why we need them, & how to use them Seeing a database as they really exist behind all the nice, pretty displays of the data Writing a simple T_SQL statement to see only what we want to see from anywhere Seeing a “real life” database on a website “in action”And if we have time, we’ll create a question that asks for the same information all the time, called a “View”
WHAT IS A DATABASE?A database takes the stress out of finding out information! How? Well, let’s look at a comparison.
WHY DO WE NEED THEM?This slide shows an Excel Spreadsheet, that contains a “bunch of information over & over again”…….why couldn’t we just store our information in one of these? The information is laid out in vertical COLUMNS & horizontal ROWS. COLUMN TITLES define WHAT TOPICS can be held in the COLUMNS. Each ROW contains the information for ONE ENTITY…described later___________________________________________________________________________________________________________________________________________?????SHOW EXCEL SPREADSHEET TO SHOW HOW FLAT IT IS, & HOW DIFFICULT IT IS TO FIND DATA, & IF YOU HAD ANOTHER SPREADSHEET, HOW COULD THE DATA BE CONNECTED?(Sorry, Gina, no time to create new spreadsheet with a bunch of tables, plus I’d have to research how to do that)…hopefully this will have somewhat of the effect you wanted….____________________________________________________________________________________________________________________________________________Imagine having a few of these spreadsheets. How could you get the information from 2 columns in one spreadsheet combined with 2 columns in another spreadsheet? You couldn’t.
A relational database, however, contains many separate things like spreadsheets, called “TABLES”, ALL CONTAINED WITHIN ONE BIG CONTAINER, CALLED THE “DATABASE”. Explain cabinet/drawer analogy, & how they are all connected together by being contained within the same thing This makes connecting the information easier ULTIMATELY THE INFORMATION IN A DATABASE IS USED TO PRESENT YOU WITH INFORMATION IN AN EYE-PLEASING WAY__________________________________________________________________________________________________________________________________
Here you are looking at a lot of information coming from a database….I bet you never realized that! So even though this is what a database looks like when you see it’s information displayed so pretty…__________________________________________________________________________________________________
This is a database without its makeup… Now, this isn’t the actual database, but a “DATABASE DIAGRAM”, which we are now ready to look at___________________________________________________________________________________________________________ If the room has laptops, follow the steps in the following slides, if not, switch to SQL Server & demo _______________________________________________________________________________________________________________
In our first activity, we are going to get familiar with the database environment SQL EXPRESS Double click on the desktop icon “SQL Management Studio Express”, which will look something like the green icon on the screen When you see the “Connect to Server” box, just press “Connect” You are now in the environment where you build & test databases! Keep clicking the “+” signs until you see the database SQL EXPRESS Find the “Boyfriend” database within it IS EVERYBODY THERE?______________________________________________________________________________________________
DO WE HAVE TO WALK THEM THROUGH ATTACHING THE DATABASE???
We are now going to continue to click on the “+” signs until the left side looks like the slide without the color, & the right slide looks like the slide because you have “dbo.TheDatingGame” selected under the DATABASE DIAGRAM folder______________________________________________________________________________________________________________________ Is everyone there? Let’s talk about what we’re looking at.______________________________________________________________________________________________________________________ Now, at the very top of my slide, you will see the database “Boyfriends” highlighted in yellow (the “file cabinet” we saw before) Notice it has a “cylinder” next to its name….databases are always represented as cylinders, because they “store information” The other 3 yellow-highlighted items on the screen are the “TABLES” within the BOYFRIENDS DATABASE (the “file cabinet drawers” we saw before) On my screen highlighted in green, are the COLUMNS of the table (= vertical information ). COLUMNS define what kind of information can be put into them On my screen highlighted in blue, are the INDIVIDUAL COLUMN NAMES OF THE TABLE. Notice some of the individual column descriptions contain the word NULL…(we will explain that further on) On my screen highlighted in orange, are the things that make up the DATABASE DIAGRAM that you see on the right side of my screen Highlighted in pink in the diagram are the RELATIONSHIPS that exist between the tables that allow you to get any amount of information out of each table & display that in another table together.
Now, let’s have some fun & see what is in the tables we saw in the previous screen! Make sure you have the BOYFRIEND database selected in the DATABASE DROPDOWN LISTClick on the New Query Button, within the pink rectangle. A “query” is asking the database for information. This opens the New Query Window Type in “Select * from Boyfriends”, ( * = All ) then press the F5 button on your computer to see what we get__________________________________________________________________________________________ Have you all done this?________________________________________________________________________________________
What you are looking at is the Boyfriend table returning all it’s content for you to see Before, we were looking at the DATABASE, IT’S TABLES, & THE COLUMNS (Database Design) Here we are looking at the ROWS, (=horizontal rows) Each ROW represents 1 “ENTITY” of the table, & in the case of a BOYFRIEND TABLE, we are looking at all the boyfriend rows in that table Notice the word NULL that I mentioned before….that means you do not HAVE to enter anything for those columns. If a column is not marked with NULL, you DO HAVE to put information there
Answers:A database stores data, restricts your data to the types of columns, and provides an easy way to retrieve data from it.Tables & columnsRowsSqlExpress, a free version of a SQL Server Database Engine.
T-SQL is the “language” you use when using a database, just as “LOL” or “BRB” is a “language” used when instant messagingRelationships enable you to prevent duplicate information from being entered, and links the tables together through “keys” so that one table can access the data in another tableIf you wanted to ask the same question many times, you can create a “VIEW” = a saved question that you can ask at any time in the future & will give you UPDATED ANSWERS each time
In our next activity, we will ask a database table for very specific information from a table Then if time permits, in the third activity, we will create a View____________________________________________________________________________________ Back in the New Query window, on a new line, type “Select * from WhoDatedWho where GirlName = ‘Paris’, then press F5 to run the query________________________________________________________________________________________ Everybody there?________________________________________________________________________________________ Next slide close up
The information returned only contains the rows in the WhoDatedWho table where the value of the column of GirlName was Paris___________________________________________________________________________________________________________ DO WE HAVE TIME TO CREATE THE VIEW? (Must have about 15-20 minutes to finish it all, if so. If not, they can follow the exercise on the slides on their usb drives______________________________________________________________________________________________________________________ If NO TIME, SKIP TO SLIDE # 21 (the coding hero) OR SLIDE # 22 (the recap questions), DEPENDING ON TIME
In the left column, scroll way down past the last table “WhoDatedWho” until you see a folder named “Views”. Right-click, “New View” In the window that appears, click on the “WhoDatedWho” table, then click “Add”, then click “Close”
Click the checkboxnext to the column name “GirlName” In the bottom area, finish the query to read “Select GirlName from dbo.WhoDatedWho where (GirlName=‘Paris’)
Click the menu item “File”, then “SaveXXXXXXView#” In the box that appears, choose a name for your View, then click OK
You now have a saved question, called a view, that you can ask the database anytime, & you will get UPDATED information for the question returned to you!
QueryYou can get as specific as you can ever imagine!View“Data”
Now, why would you want to be a database developer? Of all the types of programmers there are, database programmers make the most money! That means more trips to the mall! More vacations, & much more! How would I know if I’d like database programming? If you like things organized, you will LOVE database programming! If you like details, you will LOVE database programming!
These are wonderful links that I suggest you investigate to further learn about the wonders of databases!
Our contact information – don’t be shy, we like to talk to you!
I WANT ONE OF THESE FROM ONE OF THEM!
Databases!!! Kim Schmidt, Gina Johnston, Lynn Langit August 2008 - Irvine, CA
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!
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!!!!!!