Questions tagged [insert-query]

A DML command that inserts new data into a recordset.

Syntax: Here is generic SQL syntax of INSERT INTO command to insert data into MySQL table:

INSERT INTO table_name ( field1, field2,...fieldN ) VALUES ( value1, value2,...valueN ); To insert string data types it is required to keep all the values into double or single quote, for example:- "value".

Source : TutorialSpoint.com

44 questions
1
vote
3 answers

How can i write a insert statement in ruby on rails?

I run a insert statement on ruby on rails. But failed. This is the code: class BookmarkController < ApplicationController def index if request.post? @user_new = Bookmark.new(params[:user_new]) tags = @user_new.tags.split(",") …
Abhi Ram A
  • 305
  • 2
  • 4
  • 10
0
votes
4 answers

how to use mysql update query and mysql insert query together?

this the condition: there is a form in html and php haivng around 120 fields its for a website i am making this form on submitting goes to a php page where i first retrive all the values using $_REQUEST[]and then using insert query insert all of…
dannysood
  • 1,129
  • 3
  • 18
  • 36
0
votes
3 answers

How to insert into a table?

Table Name: free_meals_bill punch_date employee_id employee_name product_name 2021-02-22 12:15:50.086471 123456 john Variety Rice - Curd - Rs.35 2021-02-22 12:19:50.086472 234456 marry Variety…
pythoncoder
  • 575
  • 3
  • 8
  • 17
0
votes
2 answers

how can I reference another column inside postgres insert query?

I have the following table: CREATE TABLE tab ( id SERIAL PRIMARY KEY, code TEXT NOT NULL, data TEXT ) In some cases, I'd like to insert a new row ensuring that the code column is generated by the id column. In other cases the code is…
riccardo.tasso
  • 978
  • 2
  • 10
  • 28
0
votes
1 answer

Don't pass Insert/drop/create request JDBC

This connection class public class AppConnect { private static final String url ="jdbc:hsqldb:file:src/main/resources/db/library"; private static final String driver ="org.hsqldb.jdbcDriver"; private static final String user = "SA"; private static…
Krit
  • 1
  • 1
0
votes
4 answers

how can I insert value into my sqlite3 database table?

I am writing a simple query as below const char *sql = "insert into abc(name) values ('Royal')"; and this will insert each time 'Royal' into my 'name', so now I want to take input from user each time as names of hotel and wants to save them instead…
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
0
votes
1 answer

Is it mandatory to insert a new record just before calling lastInsertId() to get the last inserted ID in PDO?

I'm trying to learn PDO. First, I inserted a record in a table successfully using below code.
PHPLover
  • 1
  • 51
  • 158
  • 311
0
votes
3 answers

How to insert if not exists with selecting from same table?

I have my table schema in H2 db as follows: create table if not exists Test ( id bigint not null,name varchar(255), primary key (id) ); alter table Test add constraint if not exists Test_NAME UNIQUE (name); I want to insert a value for the name…
0
votes
4 answers

how to prevent of duplicating records in mysql insertion queries?

i always in inserting data into a mysql table i use a select for that data before inserting to avoid duplicate records and if the query return null then i insert record. but i think maybe it is not a professional way to do this job. would you let me…
hd.
  • 17,596
  • 46
  • 115
  • 165
0
votes
2 answers

How to add culture invariant info in timestamp in Postgresql?

How to add culture invariant info while adding timestamp in Postgresql database ? Create table query: CREATE TABLE Table1(Id SERIAL NOT NULL PRIMARY KEY,CreatedDate TIMESTAMP); Insert query: insert into Table1 (CreatedDate) values…
Shesha
  • 1,857
  • 6
  • 21
  • 28
0
votes
2 answers

c# mysql insert query, if record exists then update

I am trying to insert the new records in table, I have two columns user_records ------------------------ | Attribute | Datatype | |------------------------| | user_id | varchar(25)| | count | int | …
Nixi
  • 7
  • 5
0
votes
1 answer

Access INSERT INTO - to few parameters. expected 2

Good afternoon, I'm having a problem with a INSERT statement in VBA. Everytime I'm trying to insert a new record to the table through input from the form I'm getting a error. Run-time error '3061': Too few parameters. Expected 2. And this is the…
PatrickStel
  • 45
  • 1
  • 9
0
votes
1 answer

Insert using stored procedure in mulitple table in C#

ALTER PROCEDURE [dbo].[sp_CreateProcess] @type varchar(50),--0 @HospitalID varchar(50),--1 @PatientID varchar(50) ,--2 @PreAuthorization varchar(50) ,--3 @Status varchar(50) ,--4 @Amount varchar(50) ,--5 @AmtWords varchar(500)…
0
votes
1 answer

SQL syntax error in php for long paragraph

i am getting SQL syntax error for long paragraph but same code is working fine for short line text. i have attached screen shot of error.! below is my insert query code. waiting for your response.
sachin
  • 23
  • 5
0
votes
5 answers

Why the data is not getting inserted into a MYSQL table?

I've created a form, database table, etc. on my local machine but the data is not getting inserted. If I run print the sql query and pasted it in PHP myadmin then it's inserting the values. Can anyone guide me in identifying the issue in not…
PHPLover
  • 1
  • 51
  • 158
  • 311