![]() USE Student opens the Student_course database, as shown in Figure 1-12. Type the following SQL query in the resulting screen: USE Student Right click on Student_course and then select New Query. To type in or work on the queries in this book, the Student_course database should be active or open. But, before you type in your query, make sure the database that you wish to work with is active or open. In SQL Server 2005, the SQL query is typed in the query editor screen, as shown in Figure 1-12. In this book, we focus on Transact-SQL (T-SQL), SQL Server’s variant of SQL. If the computer cannot figure out what the instruction means, it displays an error message. If the instruction is “understandable” to the computer, the computer produces a result. The computer analyzes each instruction and interprets it. A query is a request for data stored in SQL Server. Like every computer language, a SQL query or statement is used to give instructions to the computer. This screen also allows you to insert data, make changes to the data, and save this changed data. This will show all 48 rows of the Student table, of which we show the first 14 rows here: STNO SNAME MAJOR CLASS BDATE For example, to view the data of the Student table, right-click on the Student table, and select Open Table. To view the data in a table, right click on the table, as shown in Figure 1-22, and select Open Table. tempdb is used for temporary tables created by users and to hold intermediate results created internally by SQL Server during query processing and sorting. Is a temporary database or workspace recreated every time SQL Server is restarted. Is a database that contains the metadata and database objects used by the SQL Server agent that performs scheduled activities such as backups and replication tasks. If you want all your new databases to inherit certain properties, you could include these properties and objects in your model database. (and all of the objects in it) to form the basis of the new database. Every time a new database is created, SQL Server makes a copy of the model database Any queries executed from the query window will execute in the master database unless you change the context. The SQL Server Management Studio query window defaults to the master database context. Is a database composed of system tables that keeps track of server installation as a whole and all other databases that are subsequently created. The final section of this chapter discusses customizing SQL Server 2005’s settings. ![]() In this chapter, you will also learn how to view and modify table definitions delete a table and a database type, parse, execute and save a query display the results in different forms stop execution of a query and print the query and results. Right-click on the script on the web site, select Save Target As, and save it to your working directory. At this point, you may want to copy the load script, SQLServer2005_load.sql, to your working directory on your computer, before you start working on the next section. This database will be used throughout the rest of the book to learn SQL. The load script will create the Student_course database for you. You will learn how to create a database, view the objects and default tables in a database, use a query editor, activate the database in different ways, and create tables in the database using a load script. This chapter introduces SQL Server 2005 and SQL Server 2005’s Management Studio and its basic workings. Chapter 1. Starting Microsoft SQL Server 2005
0 Comments
Leave a Reply. |