SQL Bible [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

SQL Bible [Electronic resources] - نسخه متنی

Alex Kriegel

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Assignment Operator

The assignment operator is one of the most
intuitive to use. It assigns a value to a variable. The only confusion in using
this operator could stem from its overloading. All RDBMS overload this operator
with an additional function — comparison — in the SQL.

The equals operator (=) is used as an assignment in the following SQL query
that updates the price (PROD_PRICE_N) column in
the
PRODUCT table, raising the existing prices
by 2 percent:

UPDATE product SET prod_price_n
= prod_price_n * 1.02 (10 row(s) affected)

And the same operator would be used for
comparing values when used, for example, in the
WHERE clause of an SQL statement:

UPDATE product SET prod_price_n
= prod_price_n * 1.02 WHERE prod_id_n = 1880 (1 row(s)
affected)

This statement assigns a 2 percent
increase to a product whose ID is 1880; in the same query, the equals operator
(=) is used in its assignment and comparison
capacity at the same time.





Note

In some SQL procedural languages, there are distinctions between
assignment and comparison operators. Oracle PL/SQL uses
:= for assignment and
= for comparison; MS SQL Server's
Transact SQL uses only one operator for these purposes,
=, as does IBM DB2 UDB.


/ 207