In Oracle, SQL queries table information because the data structure design of some modules of the project is not strictly in accordance with a certain specification design, it can only beTo query the data structure, you need to query the following information: field name, data type, whether it is null, default value, p
SQL statement for querying and deleting duplicate records1. Search for redundant duplicate records in the Table. duplicate records are determined based on a single field (peopleId ).Select * from peopleWhere peopleId in (select peopleId from people group by peopleId having count (peopleId)> 1)2. Delete unnecessary duplicate records in the Table. Repeat records are determined based on a single field (eagleid), leaving only the records with the smallest
Oracle journey (ii) SQL statement query settings such as t_chmo_order_opera p, business table t_chmo_teruser u, user table t_chmo_province, Province table t_chmo_opera_price r price list ----- value-added business details select p. oo_source_num as phone number, r. opera_price as amount, cp_province_name as region, p. oo_create_time as date, u. ct_category as ope
SQL statements for Oracle management and query
Tablespace and capacity:
Select tablespace_name, sum (bytes)/1024/1024/1024 from dba_data_files group by tablespace_name;
Free space of the tablespace:
Select tablespace_name, sum (bytes) from dba_free_space group by tablespace_name;
System tablespace:
Select tablespace_name from dba_tablespaces;
System data
Page query SQL statement for the Oracle database tutorialOracleSELECT *From (select RowNum r,t1.* from table name T1 where rownum where T2.R >= m
For example, from the table sys_option (primary key is sys_id) from 10 records or retrieve 20 records, the statement is as follows:
SELECT *From (select RowNum r,t1.* from sys_option where RowNum where T2.R >= 10
MyS
Label:SELECT * FROM (SELECT Tt.*,rownum RN from(SELECTa.case_id as Treatid,A.type as TYPE,B.content as CONTENT,b.add_user_id as Adduserid,B.add_user_type as Addusertrpe,A.create_time as Createtime,B.check_time as Checktime,E.addusertypeFrom T_medical_case ALeft JOIN t_treatment B on a.case_id = b.treat_idLeft JOIN (select c.patient_id as ID, C.user_name, ' 2 ' as AddusertypeFrom T_patient_info CUNIONSelect d.doctor_id as ID, D.user_name, ' 1 ' as AddusertypeFrom T_doctor_info D) E on b.add_user_
[SQL] Three Methods of Oracle paging Query use the pseudo column rownum to query the first 10 records
[SQL] select * from t_user t where ROWNUM
[Note] 1.
where rownum>1Records cannot be captured. 2.
where rownum between 2 and 10And cannot capture records. Use the analysis f
Preface
The best way to learn is practice! Therefore, my learning is based on practice. The most basic SQL statement is the query statement. Therefore, I also learned from the select statement. (In fact, this part of the author) has been mastered, but it is still necessary to grasp it again.
For the previous study, we mainly used some existing tables in the Oracle
Label:1.oracle querying the number of tables in the database:Select COUNT (*) from User_tablesThe premise of this operation is that the login is successful2.mysql querying the number of tables in the database:SELECT COUNT (*) TABLES, table_schema from INFORMATION_SCHEMA. TABLES WHERE table_schema = ' database ' GROUP by Table_schema;Change the database three words to the name of their corresponding databaseQuery the number of tables in a data in 3.sql
SQL statement for querying and deleting duplicate records1. Search for redundant duplicate records in the Table. duplicate records are determined based on a single field (peopleid ).Select * from peopleWhere peopleid in (select peopleid from people group by peopleid having count (peopleid)> 1)2. Delete unnecessary duplicate records in the Table. Repeat records are determined based on a single field (eagleid), leaving only the records with the smallest
Recursive query of Oracle PL/SQL-CONNECT BY PRIOR:
Duzz $ scott @ orcl>SELECTEmployee_id, last_name, job_id, manager_id
2FROMEmployees
3 STARTWITHMaid = 101
4CONNECTBYPRIOREmployee_id = manager_id;
(PRIOR: Previous, with priority; perform recursive queries based on the previous employee_id that is equal to the row's manager_id, from top to bottom)
EMPLOYEE
Copy Code code as follows:
-Oracle takes the SQL from Monday to the weekend
This takes the first days of the week, starting with Sunday.
Select To_char (to_date (' 20130906 ', ' yyyymmdd '), ' d ') from dual;
--Result: 6 Note: 2013.09.06 is Friday, the sixth day of the week
Select To_char (sysdate+ (2-to_char (sysdate, ' d '))-7, ' YYYYMMDD ') from dual;---Monday
Select To_char (sysdate+ (2-t
nameSELECT * from emp order by ename;--18. Show employee name and date of employment, according to their service life, the oldest employee card at the frontSelect Ename, HireDate from emp order by HireDate;--19. Show the name/work and salary of all employees, sorted in descending order of work, sorted by salary if co-work is the sameSelect ename, Job, Sal from emp order by job Desc, Sal;--20. Displays the names of all employees/the year and month in which the company was joined, arranges the mo
Label:Recently, a simple study of the data paging query of oracle,mysql,sqlserver2005 has been made, and the statements of each query are posted for everyone to learn. (a), the MySQL paging query MySQL paging query is the simplest, with the help of keyword limit can be
Tags: style blog http ar color OS using SP dataOriginal: SQL Server access Oracle Query performance Problem Resolution1. Questions The system has a module that needs to query the data in the Oracle database. It is now implemented by establishing a linked server.
NUMBER
Hash value of the action that's named in the ACTION column
SERIALIZABLE_ABORTS
NUMBER
Number of times the transaction fails to serialize, producing ORA-08177 errors, totalled through all the child cursors
CPU_TIME
NUMBER
CPU time (in microseconds) used by the cursor for parsing/executing/fetching
ELAPSED_TIME
NUMBER
Elapsed time (in microseconds) used by the cursor for parsing/executing/fetching
) A. Need to display the account opening date under each customer account B. Need to display the date on which the customer placed the order C. Need to display all orders placed on a specific date D. Need to display all orders with the same release date as the order numbered 25950 8. Which of the following SELECT statements should be used if you want to display the product names in the report that cost values are higher than the average cost of all products? (B) A. Select Product name from produ
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.