, execution time 10.6 seconds)
SELECT ...
From EMP E
WHERE
WHERE mgr=e.empno)
and SAL > 50000
and JOB = ' MANAGER ';
6. Avoid the use of ' * ' in the SELECT clause
When you want to list all columns in the SELECT clause, it is a convenient way to use the dynamic SQL column reference ' * '. Unfortunately, this is a very inefficient approach. In fact, Oracle
Oracle-specific SQL statement sorting. We usually want to select the original column and the statistical value column as many as possible during statistical analysis. However, in this way, the groupby must follow more
Sort SQL statements with Oracle characteristics. We usually want to select the original column and the
Tags: format art drive different user name localhost com bcp micConfiguration 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 method of configuring data sources for different
24.Use EXPLAIN PLANAnalyze SQLStatement
Explain plan is a good tool for analyzing SQL statements. It can even analyze statements without executing SQL statements. through analysis, we can know how ORACLE connects to the table, how to scan the table (index scan or full table scan), and the index name used.
You need to interpret the analysis results in the order f
you do not specify a clause in the query, the corresponding step is skipped. Introduction to the Logical query processing phase: 1. From: Performs a Cartesian product (cross join) on the first two tables in the FROM clause, generating the virtual table VT1. 2. On: Apply on filter to VT1, only those that are true are inserted into TV2. 3. OUTER (Join): If a OUTER join (relative to a cross join or inner join) is specified, a matching row in the reserved table is added to VT2 as an outer row, gene
Common Oracle SQL skills (conversion) and oraclesql skills
1. Avoid "*" in the SELECT clause.When you want to list all columns in the SELECT clause, using dynamic SQL COLUMN reference '*' is a convenient method. unfortunately, this is a very inefficient method. in fact, ORACLE
1. The connection order in the WHERE clause:Oracle parses the WHERE clause in a bottom-up order.According to this principle, the connection between tables must be written before other where conditions, and those conditions that can filter out the maximum number of records must be written at the end of the WHERE clause.Example:(Low efficiency)Select ... from table1 t1 where t1.sal > and t1.jobtype = ' 0001 ' and EfficientSelect ... from table1 t1 where 2. Avoid using "*" in the SELECT clause:When
One simple health check for oracle with SQL There are some sqls which is used for check the oracle database's health condition.
[sql] ------numbers of process [sql] select count(*) process_num from v$process; [sql] select SESSIO
I. oracle basic SQL statements and functions, and oraclesql Functions
I. Data Definition Language (ddl)
Data definition language (ddl) is used to change the database structure, including creating, changing, and deleting database objects.
The Data Definition Language commands used to manipulate the table structure include:
Create table
Alter table
Truncate table
Drop table
Eg,
-- Create the data structure of
created user is locked. As soon as you install Oracle, some users, such as Scott, are locked. You can unlock it like this.Alter user Scott Accountunlock;If you want to lock Scott, it's natural that alter user Scott Accountlock;However, the new user at this time is not in this case, or is not a permission. Just connecting to the database requires a separate permission. (There is no such permission in SQL Se
Scenario: Record the ID of the change in the Users_log table when the users table is Insert,update,delete
Creation of MySQL triggers
Trigger Time: Before,after
Trigger Event: Insert,update,delete
NEW and Old keywords:
| Action | NEW | Old |
|--------|----------------|----------------|
| Insert | New Data to insert | No |
| Update | New Data Modified for | Original Data Modified |
| Delete | No | Deleted Original Data |
DELIMITER $CREATE TRIG
Authoring Rules
Casing is not sensitive.
Statements can occupy one or more rows.
Keywords cannot be omitted, or split into multiple lines.
The usual case clause is exclusive of one row.
Use indentation to increase the readability of the statement.
In Sqlplus or other tools, a semicolon is added to the end of each statement. Tell the client that your statement is over.
SELECT can perform arithmetic operations on field
View and index of basic PL/SQL
PL/SQL: a programming Language combined with a Structured Language (Structured Query Language). It is an extension of SQL and supports multiple data types, such as large objects and Collection types, you can use control statements such as conditions and loops to create stored procedures, packages, and triggers, and add program logic
1. Check the number of tables in the specified user table in the SQL statement of Oracle (provided by Koko)
Bytes ------------------------------------------------------------------------------------------------------------
Syntax:
Select * From dba_tables t where T. Owner = 'user id ';
Dba_tables: a dba with Permissions
User ID: Oracle user name
table, and we have to make some comparisons to the records, we can use the self-coupling.--list the names of employees and their supervisorsSELECT E1.name,e2.nameFrom EMP e1,emp E2WHERE E1. mgr_id = E2. emp_idThe--e1 table can be seen as a table that holds employee information, and the E2 table is the table that holds the supervisor information.--Using the base tableSELECT C.cust_name, P.prod_descFrom Customer_tbl C, Products_tbl P, Orders_tbl OWHERE
For work reasons, this new need to read Oracle data remotely from 64-bit SQL Server, these days from the Internet to find a variety of solutions, the general meaning can understand (through the ODBC data source access), but the actual application will always have such a problem, In fact, you are too thought highly the new ability of the reason. Fortunately after two days of pondering, I in some articles hel
Oracle
This is the SQL BASIC statement for the Oracle database,
SQL Plus execution passes the
------------------------------------------------------------------
Select Empno, To_char (Sal, ' 999,999.99 ') Sal from EMP;
SELECT DISTINCT deptno from EMP;
Select empno,ename,sal*0.5 from emp where deptno=10;
Select Empno|
Brief Introduction
InstallShield has built-in support for MySQL and Oracle. However, this function is implemented through ODBC and has strict requirements on the SQL script format. Therefore, an error is often reported when the script that has been tested on the official client is executed in is.
Generally, database scripts can only be tested through the official client. It is time and effort-consuming to m
I. Syntax differences.
1. Table Data Replication· Data replication in the databaseMs SQL ServerInsert into copy table name SELECT statement (copy table already exists)Select field list into copy table name from table (copy table does not exist)· OracleInsert into copy table name SELECT statement (copy table already exists)Create Table copy table name as select statement (the copy table does not exist)
I
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.