Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Enter slide title here ► Enter bullet text here ► Second level ● Third level Polaris Database Theory Kellie Conner Customer Product Advocacy Manager 1 The Polaris Database Enter slide title here ► Introduction ► Enter bullet text hereto the Polaris database ► Second level ● a relational database is structured ● How Third level ● Data types ► Linking tables ► Keys ► Join types ► Learning to choose your tables 2 Polaris Database Enter slide title hereStructure ► Enter bullet Tables text here Fields ► Second level ► Logical Groupings of ● Third level fields ► Each table has at least one common field that links it to another table ► Multiple tables cut down on repetition ► Where the data is stored ► Used as unique identifiers to link tables (keys) ► Can have many different formats ► String ► Integer ► Date 3 Table and title Field Descriptions Enter slide here ► Enter bullet text here Table Name ► Second level ● Third level Field Names 4 Polaris Database Enter slide title hereStructure ► Enter bullet text here ► Inside thelevel table, the data is organized into records and fields ► Second ● Third level ► Each record consists of data entered into multiple fields ► The table contains as many records as are needed to represent the data ► Also known as rows and columns 5 Data Enter Formats slide title here ► Data can have many different formats ► Enter bullet text here ► Second level choose the format to reflect the required data type, ► Programmers ● Third level and also to allot dedicated space in the field ► Common data types include: bit, tiny int, small int, Char, Varchar, Numeric, text, identity, DateTime 6 Data Enter Formats slide title here ► Bit – either a 1 or a 0 ► Enter bullet text here ► Second level ► Tiny Int / Small Int / Int – interger data of various lengths ● Third level ► Chars (20) – allows for 20 dedicated spaces ► VarChar (200) – allow up to 200 spaces, but will resize the field if you use only 50 7 Data EnterFormats slide title here ► only numeric data permitted ► Number Enter bullet–text here ► Second level ► Will allow ● Third levela decimal ► Text – will allow extreme amounts of data ► Indentity – Sql will automatically assign the record (row) number ► DateTime – will record up to the second 8 Linking Enter slide title here ► Tables are linked together so that records from one table will ► Enter bullet text here match thelevel related records in another table ► Second ● Third level ► Use a field that is common to both tables, and uniquely identifies the data ► This is called a key ► Tables can only be linked by like data types 9 Database Enter slide keys title here ► There are three basic types of keys ► Enter bullet text here ► Primary Second level ► ● Third level ► Foreign ► Combination 10 Primary Keys Enter slide title here ► Enter bullet text here ► A ►primary key is a unique Second level ● Third level identifier for a record in a table ► Often named with ID at the end of the field name ► Table can have only one primary key ► A field can be a primary key in more than one table 11 Foreign Keys Enter slide title here ► A foreign key is a unique ► Enter bulletof texta here identifier record in ► Second level ● Third level(where it is its another table own primary key) ► Often named with ID at the end of the field name ► Tables can have more than one foreign key ► Fields can be a foreign key in more than one table 12 Combination Enter slide titleKeys here ► A combination key is also a identifier for a record in ► unique Enter bullet text here ► Second level a table ● Third level ► This key requires more than one field to identify the ‘uniqueness’ about the record in the table ► A combination key can have as many fields as are required to identify the ‘uniqueness’ of the record 13 Linking Tables Enter slide title here ► FROM Table ► Enter bullet text here TO Table ► Second level ● Third level ► Primary Table Lookup Table ► Left Table Right Table ► Different terminology for the same thing 14 Link EnterRelationships slide title here ► Enter bullet text here ► In► every there can only be one primary table Secondrelationship level ● Third level ► Multiple lookup tables are permitted ► You may have more than one relationship in your query or report 15 Link EnterRelationships slide title here ► of here link relationships ► Two Enter types bullet text ► Second level ● Third level ► Primary Key Primary Key ► Primary Key Foreign Key 16 Data Enter Relationships slide title here ► to 1: fortext every ► 1 Enter bullet here record in the primary table, there is a match in ► Second level the lookup ● Third table level ► ie. Items to material types ► 1 to many: for every record in the primary table, there are multiple matches in the lookup table ► ie. bibliographic records to items 17 Data Enter Relationships slide title here ► Enter bullet text here ► Second level ► Many to many: multiple records in the primary table match ● Third level multiple records in the lookup table ► ie. patron records to patron blocks 18 SQL Enterjoin slidetypes title here ► main ► Three Enter bullet textjoin heretypes ► Second level ► Inner ● Third level ► Left outer ► Right outer ► Periodically useful ► Union 19 SQL EnterJoin slide Types title here ► Inner join ► Enter bullet text here ► Results Second level ► include all records where the linked field value in ● Third level both tables is an exact match. 20 SQL EnterJoin slide Types title here ► Left Outer Join ► Enter bullet text here ► Includes Second levelall exact matches PLUS a row for every record in ► ● Third level the primary (left) table whose linked field has no match in the lookup (right) table. 21 SQL EnterJoin slide Types title here ► Right Outer Join ► Enter bullet text here ► Includes Second levelall exact matches PLUS a row for every record in ► ● Third level the Lookup (right) table whose linked field has no match in the primary (left) table. 22 Learning totitle pickhere your tables Enter slide ► Tables ► Choosing Enter bullet text here ► Second level ► First step is to know what you want to Report on ● Third level ► Use the database help on the extranet ► Depict the tables visually and draw your linking arrows 23 Example 1 title here Enter slide ► ► List Enternew bulletpatrons text here entered over the last year. Include their Name, ► Second level email●address, Third level and if they have any stops on them. ► Tables: PatronRegistration, PatronStopDescriptions,, PatronStops. ► Key: Patron ID, PatronStopID 24 Example 1 title here Enter slide ► Enter bullet text here ► Second level ● Third level 25 Example 2 title here Enter slide ► Bibtext records ► List Enterall bullet here entered since Jan1/99. Include title, author, ► Second level their status and the date each was entered into the system. ● Third level ► Tables: BibligraphicRecords, RecordStatuses ► Key: RecordStatusID 26 Example 2 title here Enter slide ► Enter bullet text here ► Second level ● Third level 27 Example 3 title here Enter slide ► titles in 1994. Group by title, materialtype. ► List Enterall bullet textpublished here ► Second level ► Tables: BibliographicRecords, CircItemRecords, MaterialTypes ● Third level ► Key: BibliographicRecordID = AssociatedBibRecordid MaterialTypeID 28 Example 3 title here Enter slide ► Enter bullet text here ► Second level ● Third level 29 Example 4 title here Enter slide ► ► Patrons Enter bulletexpired text herebefore Jan1/99. Include name, address, tel.# ► Second level ► Tables: PatronRegistration, PatronAddresses, Addresses, ● Third level PostalCodes, Countries, AddressTypes ► Key: PatronID, AddressID, PostalCodeID, CountryID, AddressTypeID 30 Example 4 title here Enter slide ► Enter bullet text here ► Second level ● Third level 31 Example 5 title here Enter slide ► items ► List Enterall bullet text with here status of held. Include barcode, Author, Title. ► Second level ► Sort by Author, ● Third level title ► Tables: BibligraphicRecords, CircItemRecords, ItemStatuses ► Key: BibRecordID=AssociatedBibRecordID, ItemStatusID 32 Example 5 title here Enter slide ► Enter bullet text here ► Second level ● Third level 33 Example 1 title here Enter slide ► patrons entered over the last year. Include their Name, email ► List Enternew bullet text here ► Second level address, and if they have any stops on them. ● Third level Select PatronFullName, EntryDate, emailaddress, Description From PatronRegistration PR with (nolock) Left Outer Join PatronStops PS with (nolock) on (PR.PatronID = PS.PatronID) Inner Join PatronStopDescriptions PSD with (nolock) on (PS.PatronStopID = PSD.PatronStopID) Where EntryDate > getdate()-365 34 Example 2 title here Enter slide ► Bibtext records ► List Enterall bullet here entered since Jan1/12. Include their Title, ► Second level Author, status ● Third level and the date each was entered into the system. Select BrowseTitle, BrowseAuthor, CreationDate, RecordStatusName From BibliographicRecords BR with (nolock) inner join RecordStatuses RS with (nolock) on (BR.RecordStatusID = RS.RecordStatusID) Where CreationDate > ‘1/1/2012’ 35 Example 3 title here Enter slide ► titlestext published in 1994. Group by title, materialtype. ► List Enterall bullet here ► Second level Select Count(*), BrowseTitle, MaterialType ● Third level From BibliographicRecords BR with (nolock) Inner join CircItemRecords CIR with (nolock) on (BR.BibliographicRecordID = CIR.AssociatedBibRecordID) Inner join MaterialTypes MT with (nolock) on (CIR.MaterialTypeid = MT.MaterialTypeID) Where PublicationYear = 1994 Group by BrowseTitle, MaterialType 36 Example 4 title here Enter slide ► expired before Jan1/99. Include name, address, tel.# ► Patrons Enter bullet text here ► PatronFullName, Second level Select StreetOne, City, State, PostalCode, Country, PhoneVoice1 ● Third level From PatronRegistration PR with (nolock) inner join PatronAddresses PA with (nolock) on (PR.PatronID = PA.PatronID) inner join Addresses A with (nolock) on (PA.AddressID = A.AddressID) inner join PostalCodes PC with (nolock) on (A.PostalCodeID = PC.PostalCodeID) inner join Countries C with (nolock) on (PC.CountryID = C.CountryID) Where ExpirationDate < ‘1/1/1999’ 37 Example 5 title here Enter slide ► items ► List Enterall bullet textwith herestatus of held. Include Barcode, Author, Title. ► Second level ► Sort by Author, Title ● Third level Select Barcode, BrowseAuthor, BrowseTitle From BibliographicRecords br with (nolock) Inner Join CircItemRecords cir with (nolock) on (cir.AssociatedBibRecordID = br.BibliographicRecordID) Inner Join ItemStatuses s with (nolock) on (s.ItemStatusID = cir.ItemStatusID) Where Description = ‘Held’ Order by BrowseAuthor, BrowseTitle 38 Conclusion Enter slide title here ► ► Questions? Enter bullet text here ► Second level ● Third level 39