I’m creating a a workout app for a local gym, but I’m having a difficult time figuring out how to populate the workouts and exercises tables. Right now, I have a ‘Add Workout’ button that displays a …
Tag: node.js
Merge Null Values in Merge Command
i must merge multible database tables in a node js windows service. so i decided to write a method that creates a sql string for this. here is my method: this method and the created sql string works nice, expect in one case. if the value in the source table column is NULL the target will not be updated. here
Datetime changing on JSON response
I am selecting start and end date of a project from project_stage named table. Here is the table elements Here datatype is DATETIME Here is the code Result on JSON response Here date time is changing its not the actual datetime which is in the table,why the date is changing on result.Here is the expected output Expected Result MYSQL DATATYPE
Sequelize foreign key reference composite primary key
i’m trying to create with sequelize (postgre) ‘Ingredient’ table, with columns normalizedName/userId where normalizedName is unique per userId. The second table is ‘IngredientQuantity’, with columns …
Comparing each colum in a row to every row in the database sql
I am building a bot that matches users based on a score they get, this score is taken from calculations done to data in a database on the request of the user. I have only 1 table in that database and a few columns (user,age,genre,language,format,…etc). What I want to do is, once the user clicks “find match” button on the
Syntax error in SQL when inserting data via nodejs
I have a simple nodejs code in pipedream that sends the body email to mySQL Database. i have checked the connection to database and its working. Here is my code const mysql = require(‘mysql2/promise’);…
Why can’t I use a local variable after a SQL query in Node.js?
I have to select all tags available in the database, so I could use them in my function, but I can’t use the variable after I assigned a value to the variable in the callback function of the query, why? Code which is not working: However this works: but why? I want to use the variable tags after that query
INSERT ON CONFLICT DO UPDATE using pg-promise helpers for multi row insert/update
I am trying to insert multiple rows to pgsql database using pg-promise. In my case, few records, which I am trying to insert, may exist already in the table. In such case, I need to update them. By …
sequelize updating multiple rows
Update multiple rows , is using a bulk update a good solution or something like the code below works ? . I supposed wanted to update all the records with the id and filename. I did try to update …
Get all tables data with Node.js and SQLite
Having these tables into a db: Athlete with fields: athlete_id, name, surname, date_of_birth, height, weight, bio, photo_id AthletePhoto with fields: photo_id, photo, mime_type AthleteResult with fields: athlete_id, gold, silver, bronze Game with fields: game_id, city, year The db model: The code so far can only send data for one of the tables: so it uses that query: SELECT athlete_id, name,