Course Hero Logo

Sql commands sql objects and access to data are

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 14 - 16 out of 288 pages.

SQL commandsSQL objects and access to data are managed through SQL commands. Standard SQLsupports a relatively small command set. You might think this would make SQL easy touse, but this is not necessarily the case. Options and conditional clauses can causeindividual command strings to become quite extensive. To the uninitiated, they can besomewhat cryptic. For example:SELECT mail.ship_code, mail.ship_date, count (mail.resp_code)FROM mailWHERE resp_code <> 0000GROUP BY mail.ship_code, mail.ship_dateORDER BY mail.ship_dateIn most cases, the best way to make a SQL database available to end-users is through aclient application that makes queries more user-friendly. Another common accessmethod is through the Internet, specifically through Web browsers. SQL Server givesyou the option of generating Extensible Markup Language (XML) output.Transact-SQL (T-SQL)Any time a command is passed to Microsoft SQL Server, it is done so using Transact-SQL, even when using the graphic management and administration tools, though youmight not realize it. Graphic tools take the action you want to perform, such as creatinga table, and generate the necessary T-SQL statements for you.There are three basic categories of T-SQL statements:Data definitionUsed to create and modify databasesData manipulationUsed to enter, modify, and extract dataData controlUsed to manage access to SQL Server data.T-SQL statements include control-of-flow statements, local variables, and other featuresthat let you write batches, short programs, and scripts (collections of batches).
SQL Server fundamentals15T-SQL and ANSI-92 (SQL-92)T-SQL is SQL-92-compliant but includes features and functionality not providedthrough SQL-92. This means that scripts written for SQL-92 will run unmodified on theSQL Server. This allows for portability between different database managementsystems.The converse is not true. Scripts written employing T-SQL-specific statements will notrun on other SQL-92-compliant systems.Database introductionIn the SQL model, data is stored in databases. SQL databases organize data in tables.Tables containrowsthat represent data records andcolumnsthat represent data fieldvalues, as shown in Exhibit 1-1.Exhibit 1-1: SQL table modelEach column has adata type, defining the format in which data is stored in that field.Data types can be a fixed length, meaning that they are always the same size, or variablelength, changing to fit the data they hold. Columns can be further defined to set defaultvalues and rules for data integrity.One value, called theprimary key, identifies each row in a table as unique. This key willcontain one or more columns representing a unique, non-null value.You can also identify the columns used for sorting and organizing data. These are calledindexes.Indexeshelp the SQL server quickly locate records containing a specifiedindex value or falling within a range of values.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 288 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
123123
Tags
Beowulf, Microsoft SQL Server, Neuromancer,

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture