SQL Query Commands

SQL is one of the most common programming languages ​​for creating and managing a database, as well as for performing various actions with the data itself.

sql commands




As practice shows, it is quite easy to learn and makes the most of the standard vocabulary of the English language. Like any other programming language, SQL has its own logic and syntax, a set of basic commands and rules for their use.

SQL Commands Classification

All standard SQL commands can be considered based on their purpose. As the basis of the unofficial classification, you can take such sets as:

  1. Commands for building queries.

  2. Commands of built-in procedures and functions.

  3. Trigger and system table commands.

  4. Sets of combinations for working with date and string variables.

  5. Commands for working with data and tables.

, SQL .

sql query commands




, , , . , , , , .





SQL , MicrosoftAccess. , , — MySQL, Internet. Oracle SQL.

SQL MicrosoftAccess

MicrosoftOffice. , MicrosoftAccess.

. SQL Access , , . , .

:

SELECT Pe_SurName

FROM Pherson

WHERE Pe_Name = '';

, , , Contacts.

SQL Access , .

SQL Oracle

Oracle – , , Microsoft SQL Server. Microsoft, - . , SQL Oracle SQL. , Oracle SQL, .





select command in sql




Oracle . , Oracle .

, , , , . Oracle . : SQL SQL, .

SELECTCONCAT(CONCAT(CONCAT(‘ ‘, sname), CONCAT(SUBSTR(fname, 0, 1), SUBSTR(otch, 0, 1))), CONCAT(‘ ‘, acceptdate)) FROM employees WHERE acceptdate > to_date(‘01.01.80′,’dd.mm.yyyy’);

, . , Microsoft SQL Server, SQL , .

SQL Internet

, , SQL . , , , .

, , , . , , SQL, , - MySQL.

SQL, , Microsoft tSQL Server.

SQL , . . , , :

$link = mysqli_connect('localhost', "root", '', 'tester');

if ( !$link ) die("Error");

$query = 'create table users(

login VARCHAR(20),

password VARCHAR(20)

)';

if (mysqli_query($link, $query)) echo " .";

elseecho " : ".mysqli_error();

mysqli_close($link);

"", : .

, MicrosoftSQLServer.

MicrosoftSQLServer

SQL. select SQL. .

update sql command




, select SQL . , , , , , Person. , , - . SQL, , :

Select * from Person

Where P_BerthDay >= ‘01/01/2016’ and P_BerthDay<= ‘03/01/2016’

, , . , . , , :

SelectP_Name -

P_SurName -

P_Patronimic -

from Person

Where P_BerthDay >= ‘01/01/2016’ and P_BerthDay<= ‘03/01/2016’

sql oracle commands




-. , , , . SQL , , . , .

SQL

, . , . SQL :

  1. Insert (. ).

  2. Update (. ).

  3. Delete (. ).

, . , , , , .

, MSSQL , .

, , - .

Insert

sql access command




— Insert. .

Insert , .

Person. SQL, .

Insert into person

Select ‘’,’’,’’,’01/01/1988’

MS SQL SERVER . , , , . , , . :

Insertintoperson(P_Name, P_SurName ,P_BerthDay)

Values (‘’, ‘’,’02/11/1986’)

, null.

list of sql commands




, Update SQL. , .

Update SQL . , , . . . , 5.

Update Person

Set P_BerthDay = ’02/10/1986’ where P_ID = 5

( ) , .

, .

SQL , . , , , .

, , . , , Excel. . . SQL , , SQLExec.

, Person. . Exec [ ] . :

CREATEPROCEDUREPrintPerson

@DB smalldatetime

@DE smalldatetime

AS

SET NOCOUNT ON;

SELECT * from Person

FROM HumanResources.vEmployeeDepartmentHistory

WHERE P_BerthDay >= @DB and P_BerthDay <= @DE

ANDEndDateISNULL;

GO

, .

.

MS SQL-, , , , . , . , .

SQL-. , , , .

SQL, , . .

, SQL , . .

:

CREATE TRIGGER Person_Insert

:

ONPerson

, ( ).

:

declare @ID int. @Date smalldatetime @nID int. @nDatesmalldatetime

:

DEclare cursor C1 for select P_ID, P_BerthDay from Inserted

DEclare cursor C2 for select P_ID, P_BerthDay from deleted

. , :

if @ID = @nID and @nDate = '01/01/2016'

begin

sMasseges ' . '

end

, , . , SQL SERVER:

altertablePERSONdisabletriggerall – , , , , altertablePERSONenabletriggerall – .

SQL , . SQL - .

: SQL , . , . , , , .

, , , , . SQL , , .

SQL , , -, . , .




All Articles