mysql insert on different dbs - sql

I have different databases and when I try inseret I get error 1064
here is my statement
Insert into (`database1.table1`.`column`) Value ('1');
what am I doing wrong
thanks

You need to use correct syntax
INSERT INTO database1.table1 (column) VALUES('1')

In mysql it would be something like
INSERT INTO `database1`.`table1` (`column`) VALUE ('1')

Related

is it possible to insert data where null value is locating by using insert into keyword

Insert into table_name
values('hyd') where col1 isnull;
INSERT syntax can't have WHERE clause. You can use INSERT INTO command for this type of use case.

Counting Null records not working

create table scoda(product varchar(25),price int,sale varchar(23))
insert into scoda values('watch',10,6)
insert into scoda values('socks',8,'NULL')
SELECT COUNT(*) AS GK FROM scoda WHERE sale IS NULL
Expected output:1
Actual output:0
help needed to continue i am beginner in sql
USE
insert into scoda values('socks',8,NULL)
(without quotes).
Problem is in insert statement:
insert into scoda values('socks',8,NULL)

How to insert empty_clob() from java to Oracle

I am having an NCLOB column in oracle. When I create a row, I need to insert an empty_clob() using normal java insert query.
Does anyone know how this is done? I am looking for something like the one below from java.
INSERT INTO MY_TABLE VALUES(1,'Abraham','empty_clob');
Thanks and Regards,
Abraham Menacherry
You should correct your insert statement:
INSERT INTO MY_TABLE VALUES(1,'Abraham',empty_clob());
You should also take a look here.
The empty_clob function is also useful as default value for the clob column.

mysql error 1064 when inserting

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(country,ping,order) VALUES (China,1,1)' at line 1
this is my code
INSERT INTO
(country, ping, order)
VALUES
('China', '1', '1');
You're missing the Table Name. Try:
INSERT INTO MYTABLENAME (country,ping,order) VALUES ('China','1','1');
are ping and order text fields or numeric? if numeric remove the ticks from the 1's
INSERT INTO Tablename (country,ping,order) VALUES ('China',1,1)
could also be reserved word try:
INSERT INTO Tablename (country,`ping`,`order`) VALUES ('China',1,1)
Your insert statement is missing the table name:
INSERT INTO tbl_name (col_name,...) VALUES (expr,...)
you are missing table name. also make sure that those quotes are necessary

Inserting a null value into the database

Good Morning,
Say I have an insert statement:
Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')
This statement doesn't seem to want to insert a null value into the database... I have also tried to insert the word "nothing".
Has anyone any ideas how to make this work? I am using SQL server 2005.
First of all, instead of 'null', try null (lose the quotes)
Then check that the fieldThree column on TblTest doesn't have any constraint prohibiting the use of null values...
Try
Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo',NULL)
Check for fieldThree not to be NOT NULL.
If you're trying to INSERT 'NULL' string, then just check if fieldThree is varchar type.
Insert INTO tblTest (fieldOne,FieldTwo) VALUES ('valueOne','valueTwo').