• SQL – How To Alter SQL Table?

    SQL – How To Alter SQL Table?

    SQL – How To Alter SQL Table? Table Of Contents: What Is Altering A Table? Syntax Of Altering A Table. Examples Of Altering A Table. (1) What Is Altering A Table? The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table. (2) Syntax Of Altering A Table? Adding A Column: ALTER TABLE table_name ADD column_name datatype; Dropping A Column: ALTER TABLE table_name DROP COLUMN column_name; Renaming A Column: ALTER TABLE table_name RENAME COLUMN old_name to new_name; Modifying Datatype Of A Column:

    Read More

  • SQL – How To Drop SQL Table?

    SQL – How To Drop SQL Table?

    SQL – How To Drop SQL Table? Table Of Content: What Is Dropping A Table? Syntax Of Dropping SQL Table. Examples Of Dropping SQL Table. (1) What Is Dropping A Table? Dropping a table means, deleting the entire table from the database. Be careful before dropping a table. Deleting a table will result in the loss of complete information stored in the table! (2) Syntax Of Dropping SQL Table. DROP TABLE table_name; (3) Examples Of Dropping SQL Table. DROP TABLE Shippers;

    Read More

  • SQL – How To Create A Table?

    SQL – How To Create A Table?

    SQL – How To Create A Table? Table Of Contents: Syntax Of Creating A Table. Examples Of Creating A Table. (1) Syntax Of Creating A Table CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, …. ); (2) Examples Of Creating A Table Example-1: Creating A New Table CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ); Example-2: Create Table Using Another Table CREATE TABLE TestTable AS SELECT customername, contactname FROM customers;

    Read More

  • SQL – How To Backup A DataBase?

    SQL – How To Backup A DataBase?

    SQL – How To Backup A DataBase? Table Of Content: Syntax Of Database Backup. Examples Of Database Backup. (1) Syntax Of Database Backup. BACKUP DATABASE databasename TO DISK = ‘filepath’; The SQL BACKUP WITH DIFFERENTIAL Statement BACKUP DATABASE databasename TO DISK = ‘filepath’ WITH DIFFERENTIAL; (2) Examples Of Database Backup. Example-1: BACKUP DATABASE Example BACKUP DATABASE testDB TO DISK = ‘D:backupstestDB.bak’; Example-2: BACKUP WITH DIFFERENTIAL Example BACKUP DATABASE testDB TO DISK = ‘D:backupstestDB.bak’ WITH DIFFERENTIAL;

    Read More

  • SQL – How To Drop A Database?

    SQL – How To Drop A Database?

    SQL How To Drop A Database? Table Of Contents: How To Drop A Database? Examples Of Dropping A Database? (1) How To Drop A Database? Syntax: DROP DATABASE databasename; (2) Examples Of Dropping A Database? DROP DATABASE testDB;

    Read More

  • SQL – How To Create A Database?

    SQL – How To Create A Database?

    SQL – How To Create A Database? Table Of Contents: Syntax Of Creating SQL Database. Examples Of Creating Database. (1) Syntax Of Creating SQL Database. CREATE DATABASE databasename; (2) Examples Of Creating SQL Database. CREATE DATABASE testDB;

    Read More

  • SQL – Insert Into

    SQL – Insert Into

    SQL Insert Into Table Of Content: What Is SQL Insert Into Statement? Syntax Of SQL Insert Into Statement. Examples Of SQL Insert Into Statement. (1) What Is SQL Insert Into Statement? The INSERT INTO SELECT statement copies data from one table and inserts it into another table. The INSERT INTO SELECT statement requires that the data types in the source and target tables match. (2) Syntax Of SQL Insert Into Statement. Copy all columns from one table to another table: INSERT INTO table2 SELECT * FROM table1 WHERE condition; Copy only some columns from one table into another table: INSERT INTO table2 (column1,

    Read More

  • SQL – Select Into

    SQL – Select Into

    SQL Select Into Table Of Contents: What Is SQL Select Into? Syntax Of SQL Select Into. Examples Of SQL Select Into. (1) What Is SQL Select Into? The SELECT INTO statement copies data from one table into a new table. (2) Syntax Of SQL Select Into. SELECT * INTO newtable [IN externaldb] FROM oldtable WHERE condition; Copy only some columns into a new table: SELECT * INTO newtable [IN externaldb] FROM oldtable WHERE condition; Note: The new table will be created with the column names and types as defined in the old table. You can create new column names using the AS clause.

    Read More

  • SQL – All Keyword

    SQL – All Keyword

    SQL ALL Keyword Table Of Contents: What Is SQL All Keyword? Syntax Of SQL All Keyword. Examples Of SQL ALL Keyword. (1) What Is SQL All Keyword? The ALL operator: returns a boolean value as a result. The ALL operator: returns TRUE if ALL of the subquery values meet the condition. The ALL operator: is used with SELECT, WHERE and HAVING statements. (2) Syntax Of SQL All Keyword. SELECT column_name(s) FROM table_name WHERE column_name operator ALL (SELECT column_name FROM table_name WHERE condition); Note: The operator must be a standard comparison operator (=, <>, !=, >, >=, <, or <=). (3) Examples Of SQL All Keyword. Product Table: Order Table: Example-1: SELECT ProductName

    Read More

  • SQL – Any Keyword

    SQL – Any Keyword

    SQL Any Keyword Table Of Contents: What Is SQL Any Keyword? Syntax Of SQL Any Keyword. Examples Of SQL Any Keyword. (1) What Is SQL Any Keyword? The ANY operator: returns a boolean value as a result. The ANY operator:  returns TRUE if ANY of the subquery values meet the condition (2) Syntax Of SQL Any Keyword? SELECT column_name(s) FROM table_name WHERE column_name operator ANY (SELECT column_name FROM table_name WHERE condition); Note: The operator must be a standard comparison operator (=, <>, !=, >, >=, <, or <=). (3) Examples Of SQL Any Keyword? Product Table: OrderDetails Table: Example-1: SELECT ProductName FROM Products WHERE

    Read More