psql – POSTGRESQL Query and insert based on results

In this case I’m trying to perform a SELECT based query followed by an insert of new records into the same table based on those results. For example a simple table:

Table "samples"

      id   unique

To be clear my objective from the selection is to create a new sample with a given name and id for each location, but the rest of the fields can be left to default. This is the selection portion:

SELECT locations FROM samples WHERE name = 'example';

The command chain below works for a single record, but I need the query and creation to be iterative. Aforementioned attempt:

INSERT INTO samples (nextval('my_sequence'), 'newsample', (SELECT locations FROM samples WHERE name = 'example');

I’ve haven’t found a solution yet and would appreciate any admonishment on this PSQL simplicity.

I realize that this is a poor example in terms of database normalization, but it’s merely for effect.

Best regards and thanks in advance.

python – How to do cURL query instead of webscraping?

(please dont downvote, comment where I should ask this)

I am trying to learn / understand how to do cURL query using python.

The website I am trying to get infos from is

What I am currently doing is to scrap the table from the website, but I want to be able to request directly from its query.

My current code follows bellow.

import pandas as pd
from selenium import webdriver
import time
import matplotlib.pyplot as plt

driver = webdriver.Chrome()

url = ''



df = pd.read_html(driver.page_source)(0)


df = df(1:)

df('Amount KDA') = df('Amount KDA').astype(float)
df('Sum_qtd') = df('Amount KDA').cumsum()
df('Price/KDA') = 10000000/df('Sum_qtd')


An acquaintance of mine told me that the following query should be utilized to accomplish what I am trying to do, but I dont know where to start.

curl '' 
  -H 'authority:' 
  -H 'sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"' 
  -H 'sec-ch-ua-mobile: ?0' 
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36' 
  -H 'content-type: application/json' 
  -H 'accept: */*' 
  -H 'origin:' 
  -H 'sec-fetch-site: cross-site' 
  -H 'sec-fetch-mode: cors' 
  -H 'sec-fetch-dest: empty' 
  -H 'referer:' 
  -H 'accept-language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7' 
  --data-raw '{"hash":"vxUfyBj6Pz3iOK9iag-yooRdEyXKg3GaDsPQAU7z94k","sigs":(),"cmd":"{"networkId":null,"payload":{"exec":{"data":{},"code":"("}},"signers":(),"meta":{"creationTime":1623428512,"ttl":600,"gasLimit":100000,"chainId":"0","gasPrice":1e-12,"sender":""},"nonce":"\"2021-06-11T16:22:01.886Z\""}"}' 

databases – How to simplify the query qualification?

Given the following DB and query :
enter image description here

enter image description here

Now if we need to simplify the query qualification, here is the answer from the book (Principle of distributed database systems, third edition) :

enter image description here

My question is in the highlighted bracket, I think this should be (p1 OR (p2 AND (Not p2))) instead of the one written because we have the following rule :

enter image description here

Is that right ?

sql – Query Condicional – Stack Overflow en español

tengo el siguiente problema.

Necesito asignar la fecha a un registro en donde tengo que elegir la fecha vigente del costo unitario.

Para aclarar el problema, por ejemplo tengo la siguiente situación:

Datos de ejemplo:

CREATE TABLE dbo.Movimiento(Cod varchar(3), Cantidad int, Fecha date);
CREATE TABLE dbo.Unitario(Cod varchar(3), Costo int, Fecha date);

INSERT INTO dbo.Movimiento 
VALUES  ('AAA',2,'20180125'),

INSERT INTO dbo.Unitario 
VALUES  ('AAA',200,'20180125'),

Query que obtiene el menor más cercano:

FROM dbo.Movimiento m
               FROM  dbo.Unitario u
               WHERE u.Cod = m.Cod 
               AND   u.Fecha <= m.Fecha 
               ORDER BY u.Fecha DESC) u 

Mi problema es que debo asignar el costo Unitario ( tabla Unitario) al código de tabla Movimiento, en donde la fecha del Movimiento debe ser menor o igual a la de la tabla de costo Unitario; sin embargo, puede existir el caso en que la fecha de costo unitario sea menor ( Por que es la vigente de ese año, como sucede en el caso del código C).

Este es el Resultado que debo obtener con el ejemplo planteado:

introducir la descripción de la imagen aquí

He estado buenas horas con el problema y aún no se me ocurre una solución. Les agradecería si me ayudan con un par de ideas.

Aquí tengo un enlace con lo que llevo:!18/4d326/15

query performance – INSERTing into a tag_map in MySQL

I have a simple article and tag_map tables as

ArticleID int(11) unsigned NOT NULL AUTO_INCREMENT,
Title varchar(255),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci

TagID int(11) unsigned NOT NULL AUTO_INCREMENT,
Tag varchar(255),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci

ArticleID int(11) unsigned NOT NULL,
TagID int(11) unsigned NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci

I add tags via PHP

$result=$mysqli->query("SELECT TagID FROM Tags WHERE Tag='$tag'");
$mysqli->query("INSERT INTO Tags (Tag) VALUES ('$tag')");

$mysqli->query("INSERT INTO Tags (ArticleID,TagID) VALUES ($article_id,$tag_id)");

I wonder if there is a faster way to do this in one query within MySQL.

Here, I need 2 or 3 queries for adding each tag.

Additionally, I hope to find a way for batch INSERT (possibly via LOAD DATA LOCAL INFILE) when we have a list of tags as


sql server – Page level Deadlock on same delete query

sql server – Page level Deadlock on same delete query – Database Administrators Stack Exchange

Duplicate Query rest end points in microservices – CQRS

I am a newbie to microservice. Currently I’m learning microservices by creating 2 microservices with CQRS pattern, with NO event sourcing, but each service has separate DB. Each service has separate end points for Command and Query. There is no separate Read store and write store.
The services communicate with each other via restend points.

From UI point of view, a Query restend point typically expects Paginated data. However when one service queries other service, the expected data need not be paginated. It just needs the data to continue the business logic (say to verify if an entity exists).

Is it ok to have two rest end points which pretty much does the same thing but the output format is different and purpose is different.

PS: This question is specific to the above implementation only (CQRS with no event sourcing and communication via restend points).

html5 – Visualización de imagen en media query

Mi inconveniente es relacionado a un carrusel de imágenes específicamente a la visualización de las mismas ya que no logro ajustarlas al contenedor, se que con la propiedad object-fit:contain se lo puede hacer y ya lo he tratado pero sigo viendo solo un porcentaje de cada imagen.

Las imágenes tienen de altura: 1280 y ancho: 333. A parte estoy utilizando “MultiSlider” para esto del carrusel.

En el html tengo lo siguiente:

<div class="principal-slider">
            <div id="slider">
               <div class="MS-content">
                  <div class="item">
                     <img class="img-slider" src="../RSC/slider/1.jpeg" alt="" id="imgSLIDE1">
                  <div class="item">
                     <img class="img-slider" src="../RSC/slider/1.jpeg" alt="" id="imgSLIDE2">
                  <div class="item">
                     <img class="img-slider" src="../RSC/slider/1.jpeg" alt="" id="imgSLIDE3">
                  <div class="item">
                     <img class="img-slider" src="../RSC/slider/1.jpeg" alt="" id="imgSLIDE4">
                  <div class="item">
                     <img class="img-slider" src="../RSC/slider/1.jpeg" alt="" id="imgSLIDE5">
               <div class="MS-controls">
                  <button class="MS-left" id="btnIzqSlide">
                     <i class="icon-left-dir"></i>
                  <button class="MS-right" id="btnDerSlide">
                     <i class="icon-right-dir"></i>

En el css tengo las siguientes líneas adentro de un @media screen and (max-width:360px):

      margin: auto;
   #slider {
      position: relative;
      width: 100%;
      margin: 0 auto 45px 0;
      box-shadow: 0 0 0 0 #1E2126,
                  0 5px 25px;
   #slider .MS-content {
      white-space: nowrap;
      overflow: hidden;
      width: 100%;
   #slider .MS-content .item {
      display: inline-block;
      width: 100%;
      object-fit: contain;
      position: relative;
      vertical-align: top;
      overflow: hidden;
      height: auto;
      white-space: normal;
   #slider .MS-controls button {
      position: absolute;
      top: 35px;
   #slider .MS-controls .MS-left {
      left: 10px;
   #slider .MS-controls .MS-right {
      right: 10px;

Según el editor no hay problemas de lógica en el html ni en el css pero yo creo que alguna cosa me falla en el css.

Les dejo una foto de como se encuentra el resultado:

visualización en disp. móvil

Por lo pronto seguiré investigando.

seo – Why did my website suddenly decrease the number of external links in the browser? I use Google tools to query and see that this is my site?

seo – Why did my website suddenly decrease the number of external links in the browser? I use Google tools to query and see that this is my site? – Webmasters Stack Exchange

wp query – Multisite – how to stop rewriting and redirecting to wrong locations?

How can I stop my wordpress multisite from rewriting my URLs from:




I have this set up in my functions.php

function add_query_vars_filter( $vars ) {
  $vars() = 'paged'; // variable for pagination.
  $vars() = 'p'; // variable page for pagination.
  return $vars;
add_filter('query_vars', 'add_query_vars_filter');

And I have no ideas why WordPress keeps rewriting my URLs.

Sometimes, it just redirects to:


That is completely wrong!

Any ideas?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123