There are two ways to create a data table in a database, just like deleting a table from a databaseVisual actions and ** operations
Needless to say, the visual operation method to create a data table is to use database management software such as n**icat to create a data table in the form of mouse clicks on the relevant options, the threshold is relatively low, and anyone with the ability to understand can be competent after being familiar with the pages and functions of the database management tool, so this article will not introduce too much. This article focuses on creating a data table by using the ** operation.
Specifically, you can create a table by writing sql.
SQL is common to all relational database products on the market, that is, the same SQL can be successfully executed on Oracle Database, MySQL, SQL Server and other databases. As a result, specific database products can be ignored.
In SQL syntax, usecreate tableTo create a data table, of course, the specific use is not as simple as two words, but also to specify the table name, column attribute name, column attribute data type, primary key, and so on. Examples of specific uses** are as follows:
create table keyword is immediately followed byThe name of the data table, followed by parentheses, the statement is used to set the name of the attribute column of the data table, the data type, whether to allow null values, the constraint of the attribute column, the default value, and so on. The primary key keyword used in the above SQL table creation example is used to set the primary key constraint of the attribute column, while references is used to set the foreign key constraint, and default is used to set the default value of the attribute column. For more knowledge about SQL, it is still necessary to learn it systematically.