Inserting New Data in SQL

The INSERT INTO statement makes inserting new data into the database very easy. All you need to do is specify into which table you want to insert data, into which columns to insert data, and finally what data to insert. The basic syntax is as follows: INSERT INTO table_name (column_names) VALUES (data_values) This line of code adds a record to the Category table: INSERT INTO Category (CategoryId, Category) VALUES (1, ‘Thriller’); You can see that inserting data is simply a matter of listing each column name (separated by a comma) in the...

read more

Creating, Altering, and Deleting Tables in SQL

Creating a Table To create a table, use SQL’s CREATE TABLE statement. Creating a basic table involves naming the table and defining its columns and each column’s data type. The following is the basic syntax for creating a table: CREATE TABLE name_of_table ( name_of_column column_datatype ) CREATE TABLE is the keyword telling the database system what you want to do—in this case, you want to create a new table. The unique name or identifier for the table follows the CREATE TABLE statement. Then in brackets comes the list defining each...

read more

Creating a Database

The first step in databases is creating the database. There are two main ways to create a database. First, many RDBMSs come with a nice, user-friendly front-end interface, which makes the task of creating a new database very easy. In fact, all it takes is a few mouse clicks, entering a name for the database, and away you go. Systems such as MS Access, MS SQL Server, Oracle, and IBM DB2 all provide a frontend interface. MySQL, however, doesn’t come with a default front end, but there are plenty of free ones available, such as MySQL Control...

read more