Tag sql joins

SQL DATABASE Keyword

CREATE DATABASE The CREATE DATABASE command is used is to create a new SQL database. The following SQL creates a database called “testDB”: Example CREATE DATABASE testDB; Tip: Make sure you have admin privilege before creating any database. Once a…

SQL CREATE UNIQUE INDEX Keyword

CREATE UNIQUE INDEX The CREATE UNIQUE INDEX command creates a unique index on a table (no duplicate values allowed) Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used…

SQL CREATE OR REPLACE VIEW Keyword

CREATE OR REPLACE VIEW The CREATE OR REPLACE VIEW command updates a view. The following SQL adds the “City” column to the “Brazil Customers” view: Example CREATE OR REPLACE VIEW [Brazil Customers] AS SELECT CustomerName, ContactName, City FROM Customers WHERE…

SQL CREATE INDEX Keyword

CREATE INDEX The CREATE INDEX command is used to create indexes in tables (allows duplicate values). Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up…

SQL CREATE DATABASE Keyword

CREATE DATABASE The CREATE DATABASE command is used is to create a new SQL database. The following SQL creates a database called “testDB”: Example CREATE DATABASE testDB; Tip: Make sure you have admin privilege before creating any database. Once a…

SQL CREATE Keyword

CREATE DATABASE The CREATE DATABASE command is used is to create a new SQL database. The following SQL creates a database called “testDB”: Example CREATE DATABASE testDB; Tip: Make sure you have admin privilege before creating any database. Once a…

SQL CONSTRAINT Keyword

ADD CONSTRAINT The ADD CONSTRAINT command is used to create a constraint after a table is already created. The following SQL adds a constraint named “PK_Person” that is a PRIMARY KEY constraint on multiple columns (ID and LastName):

SQL COLUMN Keyword

ALTER COLUMN The ALTER COLUMN command is used to change the data type of a column in a table. The following SQL changes the data type of the column named “BirthDate” in the “Employees” table to type year:

SQL CASE Keyword

CASE The CASE command is used is to create different output based on conditions. The following SQL goes through several conditions and returns a value when the specified condition is met: