24
by George Squillace MCT, MCSE, MCDBA, MCITP – Business Intelligence Development, MCITP – Database Administration, MCITP – Enterprise Messaging (Exchange 2007), MCITP – Windows Server 2008 Enterprise Administrator, MCTS – Vista Deployment, A “Big Picture View” of SQL Server Database Development and Database Administration

b y George Squillace MCT , MCSE, MCDBA, MCITP – Business Intelligence Development,

  • Upload
    grady

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

A “Big Picture View” of SQL Server Database Development and Database Administration. b y George Squillace MCT , MCSE, MCDBA, MCITP – Business Intelligence Development, MCITP – Database Administration, MCITP – Enterprise Messaging (Exchange 2007), - PowerPoint PPT Presentation

Citation preview

Page 1: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

by George Squillace

MCT, MCSE, MCDBA,MCITP – Business Intelligence Development,

MCITP – Database Administration,MCITP – Enterprise Messaging (Exchange 2007),

MCITP – Windows Server 2008 Enterprise Administrator,

MCTS – Vista Deployment,CompTIA A+, Network+

A “Big Picture View” of SQL Server Database

Development and Database Administration

Page 2: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Topics Basics of Database Administration Basics of Database Development Relevant Courses Certification Tracks Resources

Q: Am I an education consultant or do I merely process orders?

Page 3: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,
Page 4: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Open SQL Server Management Studio (SSMS) Start button

>>All Programs○ >>Microsoft SQL Server 2008

>>SQL Server Management Studio Navigate the Object Explorer pane

Observe Instance Properties○ Look at the “Security” page

Observe Database-specific Properties○ Look at the “Files” page

Observe Object Explorer hierarchy○ Databases >> Tables >> Columns, etc.

Page 5: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Create a Database Use code

Open a New Query WindowCreate Database BusinessSystemDBClick on the “Execute” button or press “F5”

Use GUIR-click on the Databases node,○ New Database

Enter the name “InventoryDB” Complete the remainder of the dialog box

Observe resulting data and log file and their available optionsThe DBA must manage the file sizes of the databases

in his/her care

Page 6: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Create Tables, Part 1 (Using the GUI)

Expand the BusinessSystemDB Right click on the “Tables” node, choose “New

Table” Create Customers table

○ CustomerID INT, Use Identity column (1000,10), Not Null

○ Company Name Varchar(40), Not Null

○ PrimaryContactName- Varchar(60), Not Null

○ FederalID INT NULL○ NumberOfEmployees, Int, NULL○ Save Table○ Add data through the “Edit Top 200 Rows” feature of SSMS

Page 7: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Create Tables, Part 2 {Make sure you’re connected to the

“BusinessSystemDB”} Create Products table

Use codeCreate Table Products (

ProdID int Identity(1,1) Not Null, ProductName varchar(30) Not Null,ProductCost money Not Null,ProductType varchar(20) Default ‘Training’ Not Null,AvailabilityDate SmallDateTime Null);

Page 8: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Insert rows into tables Insert INTO Products(ProductName, ProductCost)Values (‘SQL Admin’, ‘3000’)

Add two of your own products by changing the code above

Page 9: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Query tables Select * from Products Select * from Customers Display a subset of columns

Select CompanyName, PrimaryContactName from Customers

Display a subset of rows using a WHERE ClauseSelect * from Products Where ProdID = 2

Page 10: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,
Page 11: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Change Authentication mode to mixed Right-click Server node in Object

Explorer, Properties○ Security Page

SQL and Windows Authentication Restart SQL Server Services

Page 12: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Create a SQL Login Expand the Security Node R-click the Logins Node

New Login○ Enter a name○ SQL Server Authentication○ Assign a password of “123”

Remove “Enforce password policy”

Page 13: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Assign Permissions to the new SQL Login Create a Database User for the new SQL

Login in the “BusinessSystemDB” database Assign SELECT permission to SQL user on

Products tableNavigate from the database to the Tables nodeRight click on the Products tableChoose PropertiesClick on the “Permissions” pageClick on the “Search” buttonClick on the “Browse” button, and then select the

new user you created.“Grant” the “Select” permission.

Page 14: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Query table as the new SQL user

Select * from Products

Page 15: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Use Import/Export Wizard to create Excel version of table R-click BusinessSystemDB

Tasks○ Export Data

Follow remaining wizard steps Open resulting Excel workbook

Page 16: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Backup up database R-click BusinessSystemDB

>>Tasks >>Back up

Page 17: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

“Destroy” the database Use your administrative

connection Truncate table Products

Verify all rows are gone Drop Table customers

Page 18: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Restore database from backup

Disconnect current connections R-click BusinessSystemDB

Tasks○ Restore

Use the Allow Overwrite option Reconnect Query both tables, to reveal

successful restoration

Page 19: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Create a View Define a View

Saved query code Create View vBriefCompanyInfoASSelectCompanyName as CN, NumberOfEmployees as EmpsFrom Customers

Test the ViewSelect * from vBriefCompanyInfo

Page 20: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Tour of Database activities Administrative activities

Manage file space allocationCreate Logins and UsersAssign PermissionsBackup DatabaseRestore DatabaseTransfer data

Developer activitiesCreate DatabaseCreate TableCreate View

Page 21: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Related Courses: 2778A Querying (3 days)

Intended for current and future Database Developers and Database Administrators

General query writers should take the End User SQL courses (Level 1 and, optionally, Level 2)

6231B Database Administration (five days)Revision “B” will be released imminently. It is a very

different book from Revision “A”. 6232B Database Programming

“Implementing…” (five days)Revision “B” was just released. It is a very different

book from Revision “A”.

Page 22: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

SQL 2008 Related Certifications

DatabaseAdministration

DatabaseProgramming “Implementing…”

Business Intelligence Development

MCTS:

70-448120 minutes,44 questions,covers SSAS, SSIS, and SSRS

MCTS:

70-433

MCTS:

70-432

MCITP:

70-450

MCITP:

70-451

MCITP:

70-452

180 minutes,88 story problems

Page 23: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Resources My Home page

www.e-squillace.com Notice the “Search” button at the top of the page Notice the “Strategies for Passing Certification Exams” link Notice the link to my library books (very bottom of home page)

Diagrams page www.e-squillace.com/tech/techdiagrams

Screenshots page www.e-squillace.com/tech/screenshotgallery

My SQL Server home page www.e-squillace.com/tech/techreference/sql See also the “Newsletters” and “User Groups” links

My BI home page www.e-squillace.com/tech/techreference/sqlbi/sqlbi.htm

Page 24: b y  George Squillace MCT , MCSE, MCDBA, MCITP –  Business Intelligence Development,

Questions ???