Database Creation With the SQL Query Analyzer |
|
The command used to create a database in SQL uses the following formula: CREATE DATABASE DatabaseName The CREATE DATABASE (remember that SQL is not case-sensitive, even when you include it in a C++ statement) expression is required. The DatabaseName factor is the name that the new database will carry. Although SQL is not case-sensitive, as a C++ programmer, you should make it a habit to be aware of the cases you use to name your objects. As done in C++, every statement in SQL can be terminated with a semi-colon. Although this is a requirement in many implementations of SQL, in Microsoft SQL Server, you can omit the semi-colon. Otherwise, the above formula would be CREATE DATABASE DatabaseName; Here is an example:
To assist you with writing code, the SQL Query Analyzer includes sections of sample code that can provide placeholders. To access one these codes, on the main menu of SQL Query Analyzer, click File -> New... Then, in the General property page of the New dialog box, you can double-click a category to see the available options.
To easily create a database using sample code, on the toolbar of SQL Query Analyzer, you can click the arrow of the New Query button on the toolbar, position the mouse on Create Database and click Create Database Basic Template:
An option from the menu fills the query window with code:
As an alternative, on the main menu of SQL Query Analyzer, you can click File -> New... Then, in the New dialog box, select a category, followed by an option, and click OK. This also would write a few lines of code for you and you can then change the sections of code that need to be changed. Whenever necessary, we will show what you should change to customize the code generated by the wizard.
|
|
||
Previous | Copyright © 2005-2016, FunctionX | Next |
|