CIS282 Midterm review
Upcoming SlideShare
Loading in...5
×
 

CIS282 Midterm review

on

  • 514 views

 

Statistics

Views

Total Views
514
Views on SlideShare
460
Embed Views
54

Actions

Likes
0
Downloads
11
Comments
0

1 Embed 54

http://rriness.spscc.edu 54

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    CIS282 Midterm review CIS282 Midterm review Presentation Transcript

    • CIS282
    • Database Server Operates as a separate “process” Need to communicate with the server using a separate application  Connection required to transmit request and response  Management Studio and SQL Server are different programs
    • Managing SQL Server Management Studio gives access to most functions/operations Query window provides method to write/execute T- SQL statements  “T” = transact SQL Service Manager provides way to start/stop Server
    • SQL Server Databases Two files are maintained  Data file (.mdf)  Transaction Log file (.ldf) Files can be spread over multiple machines  Always need a primary file group
    • Database Contents Tables  User tables hold data  System tables hold data about the database Stored Procedures, User Defined Functions Views Indexes
    • Default Databases Master: Logins/User roles; system configuration; names/locations of databases; SQL Server startup Tempdb: Lasts duration of SQL Server session; temporary holding space Model: Sets characteristics of new databases MSDB: Holds information about jobs SQL Server Agent runs
    • Security Windows Authentication: Windows network logins used Mixed-mode: Windows OR SQL Server logins used Login: To access server User: To access a database Network security trumps all….
    • Roles Server – administrative functions  Task based:  Backup  Create database  Roles are fixed Database/Application – groups of users with common activities  Read/write all data  Read/write select data  Read data only
    • Normalization Process for reducing duplicate and redundant data 1st Normal Form: eliminate repeating groups 2nd Normal Form: each column in a table depends on the primary key  can’t get information with only part of the key 3rd Normal Form: A column cannot be dependent on another column that isn’t the primary key
    • Relationships Types  One-to-one  One-to-many  Many-to-many Requires a primary key on the ‘one’ side, foreign key on the ‘many’ side Referential Integrity defines how values work across tables
    • Table Definition Fields need a name and datatype  SQL Server datatypes are different from Access and procedural programming language datatypes Fieldnames can include spaces – but poor practice Identity – create unique number for each row
    • Constraints Allow Null – value not required to add record Check Constraints – test field or row values Default value – if no data is entered into a field Unique – values must be different for each row
    • Database Diagrams Illustrate database design Add, modify tables, indexes, relationships Can control view, table details
    • Indexes Help to select and find records Serve as a “cross-reference” Can be based on one or more fields
    • Good Index Characteristics Low maintenance columns Includes columns used frequently in Where or Order By clauses Don’t have to go out to table for data Help search for ranges of records
    • Action Queries Insert: insert into tablename(fieldlist) values(valuelist) Update: update tablename set field1=value1, field2=value2 Delete: delete from tablename [where condition]
    • Select Statement Can use an alias for fields and/or tables Select fields From table  Join table On field=field  Inner – both tables have records with matching values  Outer – all records from one table and any matches found in second table
    • Where Conditions to determine records returned Multiple conditions require And … Or Can use where clause to implement join between tables Sub-queries allow tables to be limited by values in a second table without using a join
    • Views Pre-defined select statement Used like a virtual tableSELECT * FROM v_CurrentEmployees
    • View Performance By default views run just as a query processed from command line  Adds second step to execution:  select from view  execute view itself Can add an index to speed execution  Specific requirements when creating an index on a view