We are now going to see some advanced functions of the SQL language, which we might need to use on complex queries or reports. Creating or dropping temporary or static tables, using and executing stored procedures, managing cursors, and working with transactions are some of the advanced SQL queries we will look at in the following sections.
There might be cases when you might want to create temporary tables; they are especially useful when using cursors.
The command to create a table is as follows:
CREATE TABLE tablename ( Fieldname type, Fieldname type)
For example, the following code will create a customer's table with two fields:
CREATE TABLE customers( name varchar(100), age int )
To create temporary tables, we usually add a #
character to the name of the table; for example:
CREATE TABLE #customers( name varchar(100), age int )