MySQL implements SQL Server ranking function

Recently, when a group sorting query is encountered in mysql, it is suddenly found that there is no group sorting such as row_number() over(partition by colname) in MySQL.And since there is no ranking function similar to row u number(), rank(), deny u rank() in SQL Server in MySQL, all of the following implementation methods are found. Here is ...

Added by whizard on Tue, 07 Jan 2020 19:01:22 +0200

General pit custom function of relational database

Custom functions, like scalar subqueries, when the result set (row number N) returned by the main query is huge, the query in the custom function will be accessed N times The only applicable scenario of user-defined function is paging query. Other scenarios basically have potential risks and need to be rewritten. SELECT rrs.o ...

Added by Gordonator on Tue, 07 Jan 2020 15:03:43 +0200

OCP learning: DDL and mode object 002

surface Type of table: The heap table contains randomly arranged variable length rows. Tables in an index organization store rows in the order of index keys. Index clusters can denormalize parent-child tables so that related rows from different tables can be stored together. Hash clustering requires rows to be randomly distri ...

Added by scoobydoo9749 on Tue, 07 Jan 2020 08:52:11 +0200

On the limitation of SQL SERVER stored procedure hierarchy

Now I want to write a SQL stored procedure, which is mainly to determine whether the current two weeks are working hours every day, and then I will have a database table of my own for corresponding update operation to output the work calendar that conforms to my company. The problem encountered now is that the trigger format is ...

Added by drax007 on Sun, 05 Jan 2020 13:14:04 +0200

Dynamic SQL loop traversal with Oracle dynamic cursors

Dynamic cursors can traverse dynamic tables, Format: TYPE cursor TYPE IS REF CURSOR; -- define a dynamic cursor Cursor type of game name; If the data of the query table is different and dynamic, dynamic cursors can be used. It should be noted that the definition of dynamic cursors, In normal stored procedures: the first l ...

Added by arctushar on Sat, 04 Jan 2020 19:07:55 +0200

The way of learning jdbc (2)

dao idea: establish a data interface: Step: 1) create a database 2) Set up the package com > shadow > domian in the project (for storing object classes) Establish object classes according to the tables in the database (in accordance with the javabean specification) 3) Set up the package com? Shadow? Dao in the project ...

Added by KCAstroTech on Sat, 04 Jan 2020 11:38:46 +0200

Get every day, week, month and year according to the start and end date of sql statement

Background: in many statistical reports, you need to enter start and end dates to query data according to different time units, and the displayed column names are your dynamic time units. Your table data is saved by the day, so you may need to do some sql functions or stored procedures to implement it. 1. Get each day in the r ...

Added by n1tr0b on Fri, 03 Jan 2020 18:40:00 +0200

Operating mysql database in python

1. Connect to mysql database To connect to mysql in python, you need to import the pymysql module first import pymysql # Connect to mysql database--- # User name, password, host name, port number # host = None, con specifies the host name, ip address, 127.0.0.1 and localhost represents the host # user = None, specify user na ...

Added by ace21 on Thu, 02 Jan 2020 16:10:19 +0200

20180822  Java database connection, some introduction of using jdbc programming

  Basic concepts of jdbc Java database connection is a set of api interface provided by Java. It accesses different databases (mysql, oracle, sqlserver) in a consistent way java.sql.* java.sql.Driver driver (how to connect to the database) java.sql.Connection connection (represents the connection channel between java progr ...

Added by JoeBrewer on Wed, 01 Jan 2020 03:30:18 +0200

Oracle regularly grabs Excel (csv format) data and writes it to database table

Oracle access to files requires UTL file, which is an Oracle built-in package. Permissions need to be granted: Create directory TEMP as' d: / test '; -- create directory and authorize. TEMP is the given path name Grant read, write on directory temp to ctmpmart? WF; -- grant permission to read and write directory Grant execut ...

Added by Static Cling on Tue, 31 Dec 2019 15:31:40 +0200