-hiredate)/7 weeks from EMP where deptno = 10; sysdate on DB2 has a timestamp. Cannot be used for computing. But the statement does not report an error. The returned result is an error. Please note! Correct Method: Select ename, (days (current date)-days (date (hiredate)/7 weeks from EMP where deptno = 10;
3. conversion functions:Example of conversion from date to character on SQL SERVER: Select ename, convert
1. Background:A project of the company to expand Service, add a short message service platform, the implementation of the Platform in accordance with predefined rules to users to actively send SMS and user-demand, two ways. SMS platform needs to be able to access three networks (mobile, unicom, telecommunications). Currently only the mobile Mas machine is connected. The message sent by the user on demand is passed through the MAS machine, and the content sent is finally saved in table T of
PL/SQL single-row functions and group functions
A function is a program with zero or multiple parameters and a return value. Oracle has a series of built-in functions in SQL, which can be called SQL or PL/SQL statements. functions are mainly divided into two categories:Singl
Tags: Oracle SQL TCL Select DatabaseIn 1977, a relational database was proposed, and the large database products were Oracle, DB2 and Sybase, medium right SQL Server and MySQL, and small representative for access.BodyCommon terminology for databases:DBMS is a database management system; DBMS is a relational database ma
Label: The execution and exception parts of PL/SQL in Oracle I. The executive section of PL/SQL.
An assignment statement.
Assignment statements are divided into two types, one defining a variable and then receiving the user's IO assignment, and the other is assigning a value to the SQL query result.
Preface --> The following content is from the Internet. If you feel like you are doing anything wrong, contact me.
I. Data Control Statement (DML)
1. insert (insert the record statement into the data table)
Insert into Table Name (field name 1, field name 2 ,......) Values (value 1, value 2 ,......);Insert into Table Name (field name 1, field name 2 ,......) Select field name 1, field name 2 ,...... From another table name;
Field Values of the string type must be enclosed in single quo
Database images are used to move database transactions from one database to another in different environments. An image copy is a backup copy and cannot be accessed directly. It is used only when an error is restored. Oracle databases differ significantly from MSSQL data operations, but there is an analogy in image operations. This article describes how MSSQL database images are implemented in Oracle databa
I. sqlserverAdvantages:Ease of use, scalability suitable for Distributed organizations, data warehouse functions for decision-making support, integration closely related to many other server software, and good cost-effectiveness;It brings flexibility to data management and analysis, allowing organizations to respond calmly in a rapidly changing environment, thus gaining a competitive advantage. From the perspective of data management and analysis, it is very important to
Single-record functions in SQL
1. ASCIIReturns the decimal number corresponding to the specified character;SQL> Select Ascii ('A') A, Ascii ('A') A, Ascii ('0') Zero, Ascii ('') Space From Dual;A ZERO SPACE------------------------------------65 97 48 32
2. CHRReturns the corresponding characters;SQL> Select Chr (54740) Zhao, Chr (65) Chr65 From Dual;ZH C---Zhao3.
SQL single row function in Oracle Database --- to_date to_charDate display formatFirst, let's take an example of the date display format ("19:35:35 ")Year:Yy: show two years show 13Yyy: show three years display 013Yyyy: Display four-digit year display 2013MonthMm: Display for two months 04Mon: indicates that APR is displayed in the character set)Month: the character set indicates that limit L is displayed)D
Tags: start input trail Mat Average SQL function tin padded user1.SQL function(1) Character function: mainly manipulating strings(2) Number function: The number of numeric types is mainly manipulated(3) Conversion functions: These functions convert data from one data type to another data type(4) Date function: processing date and Time(5) Regular expression functi
. Identify the ' inefficient execution ' of the SQL statement
Use the following SQL tools to find inefficient sql:
SELECT executions, disk_reads, Buffer_gets,
ROUND ((buffer_gets-disk_reads)/buffer_gets,2) Hit_radio,
ROUND (disk_reads/executions,2) Reads_per_run,
Sql_text
From V$sqlarea
WHERE executions>0
and buffer_gets > 0
and (Buffer_gets-disk_rea
Tags: database configuration in spring JDBC driver packageConfiguration of data sources in spring and JDBC driver packages for various databases (Oracle, MySQL, SQL Server, etc.)When developing a database-based application system, you need to configure the data source in your project to obtain a database connection for the operation of the database. The methods for configuring data sources for different dat
In the case of query ordering in Oracle, if there are null values in the Sort field, the sort result may not be the result you want.such as SELECT * from Tabletest ORDER BY VISITS DESC overwrites the original SQL statement to: SELECT * from Tabletest ORDER BY VISITS Desc nulls last, "nulls Last "control puts the null record in the back, of course, you can also use" nulls first "to put control records in fro
Today, we found a bug in the project, that is, about field sorting.
I wanted to get the result as follows:
However, the result is as follows: Put the A1 fan to the last one:
It is determined that it is not a plug-in problem, it must be an SQL problem. Because the original project is SQLServer, and then migrated to Oracle, this problem occurs.
The SQL statement
=f.id) Xiaoshou from Fruit F XML typeIn the pivot column switch example above, you already know what types of queries need to be queried, including in (), assuming that if you don't know what the values are, how do you build the query? Another clause in the pivot operation XML can be used to resolve this problem. This clause allows you to create an output that performs a pivot operation in XML format, where you can specify a special clause of any rather than a literal value Examples are as follo
oracle| optimization
1. The statements that have been validated are exactly the same as those already in the shared pool
2. Variable names as consistent as possible
3. Rational use of outer joins
4. Use fewer layers of nesting
5. Multi-use concurrency
The optimization steps for a statement are generally:
1. The SGA area is adjusted so that the SGA area is optimally used.
2. optimization of the SQL statemen
Common commands and functions of Oracle SQL * plus, oracleplus
Common commands:
Connect to sqlplusRun cmd in the command line to enter. For example, to log on in sys mode, the command is as follows:(1). sqlplus "sys/zhb126 as sysdba"
(2). sqlplus/nolog connect sys/zhb126 as sysdba
(3). sqlplus scott/tiger
Start a database instance
Startup -- start the control file and data file while starting the database
S
must be selected as the base table.For the order of Where conditions, the conditions for filtering the maximum number of query records must be written at the end of Where conditions.When using a complex function for the Where condition, you must note that you must write it to the beginning of the Where condition. 3. IndexingA table with a small number of records can be retained with a primary key index. Do not create other indexes. The full table scan is fast.It is best to create a tablespace f
Label:1, develop a good habit of becomingStatement 1:select * from TB_SHIYQ;Statement 2:select * from TB_SHIYQ;These three statements at first glance are the same, but the cache is not recognized, is the full character match, the index in the cache will store three different statements, speaking here, and lead to a habit, is to maintain good programming habits, this is very important2. The order of the tables after the FROM clause is fastidious①oracle
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.