SqlServer uses cursors to update data in batches

Intro Cursors can be very useful sometimes. When updating a small part of data, they can easily update the data. There is no need to write another small tool to do this, just write SQL directly Sample Here is a practical example: -- Declare field variables DECLARE @RegionCode INT; DECLARE @RegionName NVARCHAR(64); DECLARE @ProvinceId INT; -- d ...

Posted by shock on Tue, 04 Feb 2020 10:02:03 -0800

ORM aggregate function details: Count

Count: used to find the number of data. The model used in all of the following examples is: from django.db import models # Define author model class Author(models.Model): name = models.CharField(max_length=100, unique=True) age = models.IntegerField() email = models.EmailField() c ...

Posted by digitalalpha on Mon, 03 Feb 2020 05:59:44 -0800

Find the number of adjacent words in large amount of data

This topic is similar to some of the search topics in Leetcode. The problem you want to deal with is: count the number of two adjacent digits of a word. If there are w1,w2,w3,w4,w5,w6, then: The final output is (word,neighbor,frequency). We implement it in five ways: MapReduce Spark Spark SQL method Scala method Spark SQL for Scala MapReduce ...

Posted by olechka on Sun, 02 Feb 2020 08:18:59 -0800

Spark SQL/DataFrame/DataSet operation ----- read data

1, Read data source (1) Read json and use spark.read. Note: the path is from HDFS by default. If you want to read the native file, you need to prefix it file: / /, as follows scala> val people = spark.read.format("json").load("file:///opt/software/data/people.json") people: org.apache.spark.sql.DataFrame = [age: bigint, name: string] scal ...

Posted by Pie on Sun, 02 Feb 2020 08:18:33 -0800

CommVault common Oracle backup commands

In the process of configuration, initiation and recovery of Oracle database backup, many Oracle database commands are needed. In this chapter, I will sort out the commands for your reference. Oracle user and instance related commands Linux/Unix platform # ps -ef | grep [p]mon orauxdb 18751 1 ...

Posted by n8r0x on Sun, 02 Feb 2020 01:09:46 -0800

C ා basic SQL Server creates database and data table

(1) Database creation 1) Database classification System database and user database; distinguish database type by viewing object Explorer; Note: the master database should not be moved. This is the database of the database. We mainly study the user database; 2) User database file composition T ...

Posted by micknc on Fri, 31 Jan 2020 22:37:31 -0800

SQL statement partition by

/****** ******/ //Initialization data create table employee (empid int, deptid int, salary decimal(10, 2)) insert into employee values(1, 10, 5500.00) insert into employee values(2, 10, 4500.00) insert into employee values(3, 20, 1900.00) insert into employee values(4, 20, 4800.00) insert into employee values(5, 40, 6500.00) insert ...

Posted by cr-ispinternet on Fri, 31 Jan 2020 15:29:07 -0800

sql--CONVERT, for XML path to solve practical problems

Demand: stores under each platform classification, name, picture path and score of each store, name, picture path and score of four products under each store Train of thought: At the beginning, stores are dynamic and easy to write, just use Ajax. But it's a bit unrealistic to ask for a query for the products under each store. At the beginning, ...

Posted by drdokter on Fri, 31 Jan 2020 12:31:24 -0800

JAVA program operation MYSQL database

Preface Before learning to operate MYSQL database with JAVA program, we need to download and configure it Eclipse and jdk1.8 , and the tools most needed this time: MySQL database and JDBC driver Download driver jdbc 8.0.11 download website: https://dev.mysql.com/downloads/connector/j/ Load driver Open eclipse and righ ...

Posted by adamata on Fri, 31 Jan 2020 10:38:20 -0800

Oracle stored PROCEDURE

Stored procedure A set of SQL statements used to complete specific database functions, which are compiled and stored in the database system. In use, the user calls and executes the stored procedure by specifying the defined stored procedure name and giving the corresponding stored procedure parameters, thus completing one or a series of databas ...

Posted by excessnet on Fri, 31 Jan 2020 01:19:42 -0800