In Oracle:1, Query database name: Select Name,dbid from V$database; or show parameter db_name;2. Query instance Name: Select instance_name from v$instance; or show parameter instance_name;3. Query the database domain name: Select value from
Query and delete duplicate records of the SQL statement 1, find redundant records in the table, duplicate records are based on a single field (ID) to determine the select * from table where Id in (select ID from table group Byid have COUNT (ID) > 1
1,describe commandHere's how to use it:Sql> describe NCHAR_TST (nchar_tst as table name)The results shown are as follows:is the name empty? Type----------------------------------------- -------- ----------------------------NAME NCHAR (6)ADDR
The Oracle Intercept character (SUBSTR), which retrieves the character position (instr), when the then else End statement uses the favoriteCommon functions: Substr and InStr1.SUBSTR (String,start_position,[length]) to substring, return
In general, the database language can be divided into the following 5 categories:1, Data Definition Language DDL (Language), used to change the database structure, including creating, modifying and deleting database objects. Includes Create, alter
[SQL]View PlainCopy
To establish the tablespace and the user's steps:
User
Create:Create user username identified by "password";
Authorization:Grant create session to user name;
Grant create table to user name;
Grant create
The cursor usage in PL SQL is very extensive and is often used to store the return values of procedures and functions, where the return value of a function solves the problem of PL SQL without table-valued functions, and generally, in Java, calls
There are two simple examples to illustrate the efficiency issues of "exists" and "in"1) SELECT * from T1 where exists(select 1 from T2 where t1.a=t2.a);When the T1 data volume is small and the T2 data is very large, the query efficiency of T12)
1. After installing the database server, there is aClicking on a button after opening will call you to log in, the username is system, the password is the password set at the time of installation (the password I set is root).。2. On the operating
Demand:Update the records in the T2 (T_STATBUF) table with the same ID as the T1 (T_MT) table into the T1 table.1. The wrong wording: 1 update table_name T1 set (a,b,c) = ( select a,b,c from table_name_2 T2 where t1.a=t2.a); In this notation, all
Early this morning because to do some operations in the database, is about the two tables associated with the update, but the statement how to write is not correct, always error, so scared (afraid not to complete the operation in time) to check, NND,
Official website: http://www.oracle.com/index.htmlSelect your "operating system" to downloadFor example:Environment: x64 Win2012 R2Oracle:win64_11gr2_databaseIllustration one: DecompressionDiagram Two: InstallationIllustration three: a command
--built-in functions--aggregate function returns a single valueSelect Count(*) fromStudentwhereSclass='95031';--count () record number of barsSelect sum(degree) fromScore T;--Sum (degree) to find the sum of resultsSelect avg(degree) fromScore
function:1 Create or Replace functionFn_test (tablenameinch varchar2)return Number is2Sqlsvarchar2( -);3Rtn Number(Ten):=0;4 begin5 --get the number of record bars for student tables6 --Select COUNT (*) into RTN from student;7 8SQLS:='Select
The merge statement is a new syntax for merging the UPDATE and INSERT statements oracle9i.With the merge statement, another table is queried based on the join criteria of one table or subquery,The connection condition matches the execution insert on
--select Name,count (ID) from Work_test GROUP by name have count (ID) >1--select Upper (name), T.*,lower (name), substr (name,1,5) from Work_test t--Even table update/*update Work_test Set (Price) = (select T.price from Work_test t where t.price=80.0
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service