Beginning SQL
Beginning SQL Beginning SQL
Figure B-29 Click the triangle next to MyTable to see the column named MyColumn listed under MyTable. Now you need to insert some data. There are two records to be inserted. If you enter the statements in the query box, then each INSERT statement must be entered and executed separately, so first type the following into the SQL entry box: INSERT INTO MyTable(MyColumn) VALUES(123); Then click the Execute button, and the data is entered into MyTable. Now clear the SQL entry box and type the following command, and click Execute: INSERT INTO MyTable(MyColumn) VALUES(888); However, an easier alternative when you have to write more than one SQL statement is to write the code in the script box. Choose New Script Table from the File menu. Now type both lines into the script box, which is the large lower textbox that has now been created. Make sure that you end each statement with a semicolon, as shown in the preceding code. Once you’ve entered both lines, click the Execute button on the toolbar just above the script textbox. To see what data is in MyTable, clear the SQL entry box and execute the following SELECT statement: SELECT * FROM MyTable You should see the screen that appears in Figure B-30: Setting Up and Using the Five Database Systems 407
- Page 802: Category COUNT(DVDPrice), SUM(DVDPr
- Page 806: This is the final SQL and gives the
- Page 810: The results from the query are as f
- Page 814: Clearly this query hasn’t returne
- Page 818: Chapter 12 Exercise 1 Solution EXEC
- Page 822: B Setting Up and Using the Five Dat
- Page 826: Next, you come to a screen that giv
- Page 830: Leave the check box for “Configur
- Page 834: For this book, the default option o
- Page 838: Now click Next to continue. In the
- Page 842: Click Finish, and congratulate your
- Page 846: Figure B-22 Click Ignore to continu
- Page 850: Figure B-26 Click the Add New Conne
- Page 856: Appendix B 408 Figure B-30 MyTable
- Page 860: Appendix B 410 Figure B-32 Click Ne
- Page 864: Appendix B 412 Click Next to contin
- Page 868: Appendix B 414 Click OK to clear th
- Page 872: Appendix B If you’re ready and ha
- Page 876: Appendix B 418 You can also enter a
- Page 880: Appendix B 420 Figure B-49 The Film
- Page 884: Appendix B 422 Now you need to inse
- Page 888: Appendix B 424 In Access it’s not
- Page 892: Appendix B 426 Figure B-56 You need
- Page 896: Appendix B 428 Then click the Run i
- Page 900: Appendix B 430 The next screen (see
Figure B-29<br />
Click the triangle next to MyTable to see the column named MyColumn listed under MyTable.<br />
Now you need to insert some data. There are two records to be inserted. If you enter the statements in<br />
the query box, then each INSERT statement must be entered and executed separately, so first type the following<br />
into the <strong>SQL</strong> entry box:<br />
INSERT INTO MyTable(MyColumn) VALUES(123);<br />
Then click the Execute button, and the data is entered into MyTable. Now clear the <strong>SQL</strong> entry box and<br />
type the following command, and click Execute:<br />
INSERT INTO MyTable(MyColumn) VALUES(888);<br />
However, an easier alternative when you have to write more than one <strong>SQL</strong> statement is to write the code<br />
in the script box. Choose New Script Table from the File menu. Now type both lines into the script box,<br />
which is the large lower textbox that has now been created. Make sure that you end each statement with<br />
a semicolon, as shown in the preceding code. Once you’ve entered both lines, click the Execute button on<br />
the toolbar just above the script textbox.<br />
To see what data is in MyTable, clear the <strong>SQL</strong> entry box and execute the following SELECT statement:<br />
SELECT * FROM MyTable<br />
You should see the screen that appears in Figure B-30:<br />
Setting Up and Using the Five Database Systems<br />
407