Home > Software engineering >  SQL single Quote(test'S)using sql
SQL single Quote(test'S)using sql

Time:04-02

how to insert single column using sql insert query insert into table value(test's);

CodePudding user response:

By specifying the column name

Let's assume the table has 3 columns c1, c2, and c2

INSERT INTO myTable (c1)
VALUES ('c1v1'), 
       ('c1v2')

OR

INSERT INTO myTable (c1)
SELECT 'c1v1' UNION 
SELECT 'c1v2'

CodePudding user response:

Assuming you are wanting to INSERT a value with an apostrophe, you need to use an escape:

INSERT INTO table
VALUES
('test''s')

CodePudding user response:

are you asking about inserting a column? if yes then

ALTER TABLE table_name
ADD column_name datatype;

else read this article about inserting into columns, it will help. it is very detailed

  •  Tags:  
  • sql
  • Related