HI..
SQL is Structured Query Language, which is a computer language for storing, manipulating, and retrieving data stored in a relational database.
SQL is the standard language for Relational Database System. All the Relational Database Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres, and SQL Server use SQL as their standard database language.
Also, they are using different dialects, such as −
- MS SQL Server using T-SQL,
- Oracle using PL/SQL,
- MS Access version of SQL is called JET SQL (native format) etc.
DIFFERENCE BETWEEN SELECT AND UPDATE
I have a simple SQL query to join 2 tables:
select veh.[YEAR],veh.MAKE,veh.model,veh.TRIMLIST,veh.ICID,vif.[vif #] from [TheVehListBeta2015-04-21] veh
inner join [vifList2015-05-04] vif
on veh.[YEAR]=vif.Yr
and veh.MAKE=vif.make
and veh.MODEL=vif.model
and (TRIMLIST like '%' + vif.Trim + '%' + Convert(nvarchar(10),vif.Drs) + '%' + vif.Body + '%' )
order by [YEAR],MAKE,model
The result of this query is: 4983 records
If I use the same query to update the number is different. Here is 2 different queries to update I have tried:
(1)
update [TheVehListBeta2015-04-21] set EVOXID=vif.[vif #]
from [vifList2015-05-04] vif
Where [TheVehListBeta2015-04-21].YEAR=vif.Yr
and [TheVehListBeta2015-04-21].MAKE=vif.Make
and [TheVehListBeta2015-04-21].MODEL=vif.Model
and TRIMLIST like '%' + vif.Trim + '%' + Convert(nvarchar(10),vif.Drs) + '%' + vif.Body + '%'
(2) Copy Codeupdate [TheVehListBeta2015-04-21]
set [TheVehListBeta2015-04-21].EVOXID=vif.[VIF #]
from [TheVehListBeta2015-04-21] veh inner join [vifList2015-05-04] vif
on veh.[YEAR]=vif.Yr
and veh.MAKE=vif.make
and veh.MODEL=vif.model
and (TRIMLIST like '%' + vif.Trim + '%' + Convert(nvarchar(10),vif.Drs) + '%' + vif.Body + '%' )
SAS uses SQL in two different ways – Where statement and Proc SQL. Where statement is one of the most commonly used SAS statements. The concept and syntax, however, were originally adopted from SQL - this is one example that SAS is a powerful language that imports and mixes syntax from other languages. Proc SQL is the main tool within SAS to use SQL. While Proc SQL is a SAS procedure, it performs many functions similar to those found within SAS data steps. Often, for data manipulation, data step or Proc SQL can be used either individually or interchangeably. Four major areas which describe the effective use of SQL in SAS Proc SQL are outlined
THANKS,
REGARDS
SRI