SQL COPY Table

The SELECT INTO statement is used to copy a table data into another table. Syntax: Select * into destinationTable from sourceTable; Example: Select * into EMPLOYEE1 from EMPLOYEE;   Next Topic: SQL RENAME Table with example. Previous Topic: SQL ALTER Table with example.  

Categories SQL

SQL ALTER Table

The ALTER TABLE statement is used to add, delete or modify a table column. It can also be used to rename a table and to add or drop constraints on a table. Syntax of ALTER TABLE to add a new column: ALTER TABLE tableName ADD columnName datatype; Example: Syntax of ALTER TABLE to add multiple … Read more

Categories SQL

SQL CREATE Table

Table: A table in SQL is a set of data which is systematically displayed in rows and columns. The CREATE TABLE Statement is used to create a new table. Syntax: CREATE TABLE tableName (columnName1 datatype, columnName2 datatype, …   columnNameN datatype);CREATE TABLE tableName (columnName1 datatype, columnName2 datatype, … columnNameN datatype); Example: CREATE TABLE EMPLOYEE ( … Read more

Categories SQL

SQL DROP Database

To delete or drop an existing database we have to use DROP DATABASE statement. Syntax: DROP DATABASE databaseName; Example: DROP DATABASE w3spoint_db;   Next Topic: SQL CREATE Table with example. Previous Topic: SQL SELECT Database with example.  

Categories SQL

SQL SELECT Database

In case multiple databases exist in the SQL schema we have to select the database before performing any operation. The USE statement is used to select any existing database in SQL schema. Syntax: USE databaseName; Example: USE w3spoint_db;   Next Topic: SQL DROP Database with example. Previous Topic: SQL SHOW Database List with example.  

Categories SQL

SQL SHOW Database List

To show the list all existing databases in SQL schema we have to use SHOW DATABASES statement. Syntax: SHOW DATABASES;   Next Topic: SQL SELECT Database with example. Previous Topic: SQL CREATE Database with example.  

Categories SQL

SQL CREATE Database

The SQL CREATE DATABASE statement is used to create a new database. Syntax: CREATE DATABASE databaseName; Note: Database name should be unique within the RDBMS. Example: CREATE DATABASE w3spoint_db;   Next Topic: SQL SHOW Database List with example. Previous Topic: SQL operators.  

Categories SQL

SQL operators

Operator: An operator is a special symbol which used to perform a specific operation. SQL operators: SQL operators are the reserved words or special symbols or characters that are used to perform specific operations. Types of SQL operators: SQL Arithmetic Operators SQL Comparison Operators SQL Logical Operators 1. SQL Arithmetic Operators: Let us consider the … Read more

Categories SQL

SQL data type

SQL data type defines the type and range of the data that can be used with SQL Server. Commonly used SQL data types: Data Type Syntax Description integer integer  Integer number. smallint smallint  Small integer number. numeric numeric(p,s) Where p is a precision value; s is a scale value. For example, numeric(7,3) is a number … Read more

Categories SQL

SQL Syntax

Syntax: Syntax is a set of rules and guidelines which defines the structure of statements in a computer language. SQL syntax: SQL syntax is a set of rules and guidelines which defines the structure of SQL statements. SQL is case insensitive. Commonly used SQL commands: 1. SELECT – It is used to extract data from … Read more

Categories SQL