postgresql – Insert values into new columns using values from old columns without locking table

The premise is simple – a table has a jsonb column; this json value always has three fields, so I decided to split the three fields into three separate columns on the same table.
Since the table is really large (in the ~100m range), I need a way to insert these json values into their own respective columns without locking the table.
Is there a way to achieve this?

database design – Insert JSONL with two columns of comma separated fields into separate rows in mysql

I have json datas in the format as shown below.

**the number of objects under ‘images'(VIEWS, ROOMS, etc.) varied for each JSON object. Not all objects have VIEWS…POOL, it may only have ROOMS.

    "propertyId":{"ea":"12345678","h":"","vo":""},
    "thumbnail":{"width":1000,"height":500,"link":"xxx.jpg"},
    "hero":{"title":"Featured Image","width":1000,"height":669,"link":"yyy.jpg"},
    "images":{
       "VIEWS":(
        {"title":"View from Property","width":1000,"height":666,"link":"a1.jpg"},
        {"title":"View from Property","width":1000,"height":666,"link":"a2.jpg"}
       ),
        "ROOMS":(
            {"title":"Room","width":1000,"height":669,"link":"b1.jpg"},
            {"title":"Room","width":1000,"height":662,"link":"b2.jpg"}
       ),
        "EXTERIOR":(
            {"title":"Terrace","width":1000,"height":666,"link":"c1.jpg"},
            {"title":"Terrace","width":1000,"height":666,"link":"c2.jpg"}
       ),
        "AMENITIES":(
             {"title":"Property Amenity","width":1000,"height":666,"link":"d1.jpg"}
       ),
        "POOL":(
            {"title":"Outdoor Pool","width":1000,"height":666,"link":"e1"},
            {"title":"Outdoor Pool","width":1000,"height":666,"link":"e2.jpg"}
    )}
    }

I wanted to insert the following data into the table with the following format in MySQL Ver 8.0.23 database.
enter image description here

JSON -> Table Reference

    HotelId = propertyId.ea
    hero_url = hero.link
    hero_title = hero.title
    media_title = images.(VIEWS/ROOMS/EXTERIOR/...).title 
    media_url = images.(VIEWS/ROOMS/EXTERIOR/...).link
    >> ...other objects may have different category (VIEWS/ROOMS...)
    created_at and updated_at = date

After searching through the old topics, I was able to use the select statement below to display the format above. However, I’m confused as to it how works when using INSERT.

  SELECT t.HotelID, t.hero_url, t.hero_title,SUBSTRING_INDEX(SUBSTRING_INDEX(t.media_title, ',', n.n), ',', -1) media_title, SUBSTRING_INDEX(SUBSTRING_INDEX(t.images, ',', n.n), ',', -1) images
  FROM hotel_sample.property_photos t CROSS JOIN 
  (
   SELECT a.N + b.N * 10 + 1 n
     FROM 
    (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
   ,(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b
    ORDER BY n 
   ) n
 WHERE n.n <= 1 + (LENGTH(t.media_title) - LENGTH(REPLACE(t.media_title, ',', '')))
 ORDER BY HotelID

Would appreciate if anyone could show me how I could insert the above JSON data into the table. (MySQL Ver 8.0.23)

CREATE TABLE `property_photos` (
  `id` int NOT NULL AUTO_INCREMENT,
  `HotelID` varchar(10) DEFAULT NULL,
  `hero_url` varchar(255) DEFAULT NULL,
  `hero_title` text,
  `category` varchar(30) DEFAULT NULL,
  `media_url` varchar(255) DEFAULT NULL,
  `media_title` text,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
  PRIMARY KEY (`id`)

php – Insert via PDO na clausula IF

Preciso de ajuda para inserir alguns dados em uma tabela sqlserver usando a cláusula IF. Tenho o retorno de uma API que insiro na tabela do sql server. Irei agendar a atualização para todos os dias para ver se há algo novo, mas toda vez que ele executa o código, ele insere as mesmas informações na tabela.

O mais lógico que pensei foi fazer um select na tabela onde irei inserir os dados e criar um IF, onde ele compara o que está na tabela e o meu retorno do request. Se for igual não faz nada, se for diferente, insere. Porém, o else não está sendo validado, mesmo que o retorno do IF seja falso.

Eu tentei If, ifelse, If (): else: endif; mas eu não pude.

Alguém pode me ajudar, por favor?

// $idSkill = Retorno API;
// $idSkillComp = Retorno SQL Server Query 

    if($idSkill <> $idSkillComp){
        try{
            $Conexao    = Conexao::getConnection();
            $query      = $Conexao->query
            ("INSERT INTO LIVEPERSON_SKILLS (DH_INSERT,idSkill,name, deleted) 
            VALUES ('$dh_insert','$idSkill','$name','$deleted')");
            $doQuery = $query->fetchAll();
        }catch(Exception $e){  
            echo $e->getMessage();}
    }else{
        echo "error";
    }

Can we add another custom option in the Insert Link option – SharePoint List (Multiple lines of Text)

Can we add another custom option below the "From SharePoint and From Address" or some where in this INSERT ribbon like Embed Code?
Any help?

enter image description here

How do I insert a timestamp in Word for the Web or Google Docs, on a chromebook, via hotkey or voice?

Desired Result:

The desired result is to insert a timestamp (local machine time or whatever) into a “Word for the Web” document or Google Docs document, on a Chromebook, by using: i) a hotkey and/or ii) voice dictation.

Formatting of the timestamp would be nice, but not necessary. Only the time of day is needed, but including the date is good too.

Any alternative solutions would be welcome, outside of Word or Google Docs, so long as it can be accomplished on a Chromebook.

Solutions I have investigated but could not get to work:

  1. Using hotkey or voice dictation to trigger a macro or script. Apparently, neither Word online nor Google Docs supports this.

  2. Google Sheets appears to allow the use of a macro to run a script, but I need this as applied to Word online or Google Docs. Google Sheets is a no-go, unfortunately.

Thank you for help.

Respectfully,

LeeRoy

sql server – Insert new rows when item is added to another table SQL

If you want to avoid a trigger you can use the OUTPUT clause and a table variable
sorry about the formatting – this web page has a mind of its own

drop table #pPeriod
drop table #dimProject
drop table #factProject

create table #dimProject (project int, status varchar(10))
declare @out table (project int, status varchar(10))
create table #factProject ( project int, status varchar(10),
pPeriod datetime2, vValue varchar(10))
create table #pPeriod( pPeriod datetime2)

— you will need more rows here
insert #pPeriod values (‘20210501’),(‘20210601’),(‘20210701’),(‘20210801’),
(‘20210901’),(‘20211001’),(‘20211101’),(‘20211201’)

insert into #dimProject (project, status)
output
inserted.project,
inserted.status
into @out
(
project
, status
)
values (1, ‘A’)

insert #factProject (project, status, pPeriod)
select o.project, o.status, p.pperiod
from @out o
cross join #pPeriod p
— add a filter to join to todays date and fetch 12 months forward

select * from #dimProject

select * from #factProject

Is there a shortcut to insert current datetime as a static value in a cell in Google Sheets?

I have a table like this:

Expense Date What it was for
120 CZK 4.5.2021. 12:30 Pizza coz I’m lazy

I use it to log some expenses, not exactly for pizza but that’s just an example. I also have similar tables where I really NEED both date and time.

I found out that Ctrl+; inserts current date, but without time. Is there also a shortcut for both date and time?

SQL SERVER INSERT CASE WHERE NOT EXISTS not working

INSERT INTO (coll18_tesutest).(dbo).(PERMIL_STATUSES) (PERMIL_STATUSES.POS, PER_MILITARY_ID, PERMIL_MIL_STATUS)
SELECT VETERAN_ASSOC.POS, VETERAN_ASSOC.ID, VETERAN_TYPE
FROM VETERAN_ASSOC 
JOIN STPR_STATUSES ON SUBSTRING(STPR_STATUSES.STUDENT_PROGRAMS_ID, 1, 7) = (VETERAN_ASSOC.ID) 
WHERE STPR_STATUSES.POS=1 AND STPR_STATUS='A'    
AND NOT EXISTS  
    (SELECT   
    (CASE
    WHEN VETERAN_TYPE IN ('AAIR','AANG','AARMY','ACG','AMAR','ANAVY','ANG')
     THEN 'ACT'
     WHEN VETERAN_TYPE IN ('DODAF', 'DODAG','DODAR','DODCG','DODMA','DODNA','DODNG') 
      THEN 'DOD'
      WHEN VETERAN_TYPE IN ('FAMAF','FAMAG','FAMAR','FAMCG','FAMMA','FAMNA','FAMNG')
      THEN 'DEP'
      WHEN VETERAN_TYPE IN ('RAIR','RARMY','RCG','RMAR','RNAVY','RNG')
      THEN 'RES'
      WHEN VETERAN_TYPE IN ('VAIR','VANG','VARM','VCG','VMAR','VNAVY','VNG')
      THEN 'HON'
 END) AS PERMIL_MIL_STATUS, 
    (CASE 
    WHEN VETERAN_TYPE IN ('AAIR','DODAF','FAMAF','RAIR','VAIR')
    THEN 'AF'
    WHEN VETERAN_TYPE IN ('AANG','DODAG','FAMAG','VANG')
    THEN 'ANG'
    WHEN VETERAN_TYPE IN ('AARMY','DODAR','FAMAR','RARMY','VARM')
    THEN 'ARMY' 
    WHEN VETERAN_TYPE IN ('ACG','DODCG','FAMCG','RCG','VCG') 
    THEN 'CG'
    WHEN VETERAN_TYPE IN ('AMAR','DODMA','FAMMA','RMAR','VMAR') 
    THEN 'M'
    WHEN VETERAN_TYPE IN ('ANAVY','DODNA','FAMNA','RNAVY','VNAVY')
    THEN 'NAVY'
    WHEN VETERAN_TYPE IN ('ANG','DODNG','FAMNG','RNG' ,'VNG')  
    THEN 'NG'
END)  AS PERMIL_BRANCH 
FROM PERMIL_STATUSES
WHERE PER_MILITARY_ID=VETERAN_ASSOC.ID
AND PERMIL_STATUSES.POS=1
AND PERMIL_STATUS_START_DATE='2021-06-30'
AND PERMIL_PRIMARY_FLAG='Y');

wp insert post – wp_insert_post if page doesn’t exist under current page

I am trying to dynamically insert a page as a child under the current page using wp_insert_post, however I need to first check if the page title exists under the current page, and if it doesn’t exist then to run the code and create the page.

The get_page_by_title seems to check if the page exists in the entire sitemap, and if the title exists it will not create the page, So I only need to check if it exists under the current page as there will be pages with the same title under other parent pages

e.g

mywebsite.com/oneparent/child-page-title

mywebsite.com/twoparent/child-page-title

Please see my code below. Is there a better way to use get_page_by_title but to only check the child pages for the current page? Or is there a better method to do this?

if (get_page_by_title($episodetitle)==NULL) {
$seasonepisode = array(
    'post_title'    => $episodetitle,
    'post_content'  => 'Some Content',                     
    'post_status'   => 'publish',
    'post_parent'   => $post->ID,
    'post_type'     => 'page',
    'page_template' => 'template-songlist.php'
);

wp_insert_post($seasonepisode);
}

reboot and select proper boot device or insert boot media in selected boot device and press a key

Cuando estaba trabajando me ha salido este mensaje y he entrado a la BIOS para ver qué es lo que ha fallado, pero a diferencia de las fallas usuales en el sistema, el boot UEFI si está cargado entonces según lo que he buscado eso significaría que el disco duro está dañado .
No soy un entendido en esto por ello si alguien sabe si hay alguna solución le agradecería.
Adjunto las imágenes de la BIOS y lo demás que sale

introducir la descripción de la imagen aquí

introducir la descripción de la imagen aquí

introducir la descripción de la imagen aquí