At present, there are three tables A, B and C. among them, A and B are one to many relationships, and B and C are one to many relationships. Now it is necessary to save the primary key of table A in B into C;
The general idea is to query out B and update table C with an update statement, bu ...
Added by bobicles2 on Tue, 16 Jun 2020 10:41:40 +0300
---------------------------------------------------------------Table building----------------Determine whether the student table exists
declare num number; --Declare parameters num type number
select count(1) into num from user_tables where table_name='student';
if num>0 then
execute immediate 'drop table st ...
Added by crinkle on Thu, 21 May 2020 18:21:15 +0300
check constraint means to filter one or more columns according to certain preset rules. If the condition is true, the filtering succeeds; if the condition is false, the filtering fails and the failure code is returned to the client.
Why do you want to list and write this separately? You often encounter irregular SQL. In many cases, you can onl ...
Added by AndyB on Wed, 13 May 2020 12:25:22 +0300
[contents] (the rest are knowledge)
Three Affairs (mastery)
Four stored procedures
Vi. process control
7, Index theory
1. What is a view
A view is a virtual table (non real existence). Its essence is to get a dynamic data set according to SQL statements and name it. When users use it, they only ne ...
Added by csplrj on Fri, 08 May 2020 11:46:25 +0300
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
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
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
CREATE TABLE STUDENT
SID INT PRIMARY KEY IDENTITY,
CREATE TABLE TEACHER
TID INT PRIMARY KEY IDENTITY,
CREATE TABLE COURSE
CID INT PRIMARY KEY IDENTITY,
TID INT FOREIGN KEY REFERENCES TEACHER(TID)
CREATE TABLE SCORE
Added by broseph on Sun, 29 Dec 2019 22:18:25 +0200
Change the large running table to a partitioned table
The code of this article is limited to monthly horizontal partition based on data time. Other requirements can be implemented by modifying the code
1. Create a partition table
The table field of this table is the same as that of the original table, with partition
CREATE TABLE `metric_data_tm ...
Added by CrimsonSoul on Tue, 03 Dec 2019 04:40:27 +0200
This article is a learning instance of. net mvc + Dapper. There is a link to the source code of the instance.
Why write this article
Because I don't like EF's bloated and Linq's awkward, I used my own lightweight orm in previous projects. In thinking about and drawing on other ORM frameworks,
Dapper found ...
Added by SteveFrost on Tue, 26 Nov 2019 22:15:59 +0200