Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Basic Properties and Operations of SQL Foundation (1)

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

SQL language has the following characteristics:

1. The SQL language is case-insensitive.

2. SQL can be written on one or more lines

3. Keywords cannot be abbreviated or branched

4. generally, each clause should be written on a separate line.

5. Use indentation to improve the readability of statements

6. SQL statements in SQL Developer can be terminated with a semicolon (;). When multiple SQL statements are executed, the semicolon that must be terminated

7. In SQL * Plus, you must end each SQL statement with a semicolon (;)

SQL Developer:

● default title alignment: left alignment

● default title displays: uppercase

SQL*Plus:

Left alignment of columns of ● characters and date types

Right alignment of columns of ● numeric types

● default field display: uppercase

Arithmetic expressions in SQL

The operation method of SQL:

Use arithmetic operators to create expressions that contain numeric and date data

+ plus

-minus

* multiply

/ divide

Arithmetic priority:

1. Multiplication and division take precedence over addition and subtraction

2. The same precedence operator is executed from left to right

3. The operation in parentheses is executed first.

4. NULL is an invalid, unspecified, unknown, or unpredictable value. NULL is not 0, nor is it a space

If there is a null in the mathematical operation, the result will be empty, regardless of addition, subtraction, multiplication and division.

The tests are as follows:

The specific case statements are as follows:

1. It shows the information of salary increase of 300 per person, and it is arranged in ascending order.

Select last_name, salary, salary+300 from employees order by salary+300

2. How much is it for each person to add 100 to his annual salary

Select last_name,salary,12*salary+100 from employees

3. It means that each employee will add 100 yuan per month, and what is the final annual salary?

Select last_name,salary,12* (salary+100) from employees

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report