error when to create table using mysql workbench - mysql

i have used mysql workbench for create table. here when i create table
why i cannot add column at my table here ? like this is error and when i want to create it i got error like this
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `aliftesting`.`testing` (
);
ERROR 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 ')' at line 2
SQL Statement:
CREATE TABLE `aliftesting`.`testing` (
)
why i got this error in mydatabase ? thanks all

Related

Add the column in mysql and has the same data like the column existing

I want to add the column name "payroll_date_on" in the table and has the default value as the other table column named "jo_time_on".
ALTER TABLE jobs ADD COLUMN payroll_time_on INT(11) AS (jo_time_on) PERSISTED;
While running this I got an error code
Error Code: 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 'AS (jo_time_on) PERSISTED' at line 1
Help me to solve this error and clone the column jo_time_on
I am using the mysql version 5.6.38
try this:
ALTER TABLE jobs ADD COLUMN payroll_time_on INT(11);
UPDATE TABLE SET payroll_time_on = jo_time_on;

SQL Query having trouble creating temporary table

I am trying to use the my table adult3 to create a temporary table with rows from the column class that correspond to the condition:
SELECT class INTO #CLTable
FROM adult3
WHERE (class = '<=50K');
but I keep getting the error :
ERROR 1064 (42000): 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
'FROM adult3
WHERE (class = '<=50K')' at line 2
I don't get what I'm doing wrong.
I believe that you are using SQL Server syntax for creating a temp table.
Try this:
create temporary table CLTable as
select class from adult3
where (class='<=50K');
You could try:
INSERT INTO [tempTableName]
SELECT class FROM adult3
WHERE (class='<=50k')

MySQL Can't create Table i don't know why

I always get this error when i try to create a Table:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE wolveserver.new_table (
);
ERROR 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 '.new_table (
)' at line 1
SQL Statement:
CREATE TABLE wolveserver.new_table (
)
I gotta say i'm a total Noob, but i wanna fix this.
You will need to define your column inside the parenthesis:
CREATE TABLE wolveserver.new_table
(col1 int,
col2 varchar(50)
);
This is rather a basic question, so you should try to google this before asking a question here in SO. To learn more about CREATE TABLE syntax for MySQL, visit here.

I am not able to create a table in MySQL from Ubuntu os

mysql> create table prasad1(empid number(1),name varchar(4));
ERROR 1064 (42000): 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 'number(1),name varchar(4))' at line 1
This is the correct query create table prasad1(empid int(1),name varchar(4));
Explanation: There is not number field type in MySQL. You can use either int or integer.

SQL syntax error maybe because of the version I use

On phpMyAdmin, when I create this table the SQL is executed correctly but when I add all the sql code
I get an error saying
"#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 'CREATE TABLEbuying(CustomerIDint(10) unsigned NOT NULL,PurchaseI' at line 14`"
Why is that and how can I fix it ?
You have to use a semicolon ; after each CREATE TABLE sometable ( ) statement.
CREATE TABLE `table1` (
...
);
CREATE TABLE `table2` (
...
);
If you are running multiple SQL statements, they need to be ended with a ; (semi-colon)