Questions tagged [create-table]

The statement that creates a table in SQL (`CREATE TABLE ...`).

The statement that creates a table in SQL (CREATE TABLE ...). Use this tag if your question refers to a problem that might have a relation with an SQL statement that involves a CREATE TABLE statement. Do not use this tag if you have no indication that the CREATE TABLE statement has no relation to the error you are asking about.

1935 questions
0
votes
3 answers

Why can't I create this table?

Creating tables in MySQL confuses me. Sometimes I'm able to get it just fine, other times it seems to yell at me for things I've done before successfully. I'm attempting to create this table with 3 columns. When I try to save the column, it tells me…
Shirley Dodson
  • 341
  • 4
  • 24
0
votes
1 answer

how to set column type with create-select statement

I am trying to create a table with a select statement and that doesn't require me to set column types. However i need the column percent to be a float but what i am getting are 0 and 1s. How do i set that column as a float or decimal? create table C…
jxn
  • 7,685
  • 28
  • 90
  • 172
0
votes
3 answers

Can I use parameters in a CREATE query?

Actually I have 2 questions, both in SQL Server. There's a query like "Create Table" but for Create columns? If it exist, please, how it is? I need to use a "Create Table" but using parameters, but I don't know if that is possible. For…
EyMarie
  • 41
  • 1
  • 8
0
votes
2 answers

Got MySQL Error #1064 on a simple insert, What am I doing wrong?

I need some help, I'm getting error 1064 when I try to insert data into a table! INSERT INTO areas (Nombre) values ('area 1'); Table: CREATE TABLE Areas ( Id INT PRIMARY KEY AUTO_INCREMENT, Nombre VARCHAR(100) UNIQUE NOT NULL ); What's…
Mauro
  • 11
0
votes
1 answer

Reducing the amout of entries when creating a TEMPORARY TABLE in SQLite3

I've got 2 databases with 3 tables in a single SQLite3 database connection. I create a temporary table on these tables/databases to support better and quicker searching/filtering. Here is an example. The real tables are much bigger. 1st…
Rolf
  • 1
0
votes
2 answers

MySQL: How to create table with auto incrementing column via script

I am new to MySQL and hope someone can help me with this. I want to create a simple table with two special settings: a two-column primary key including the columns "de" and "location" an auto incrementing column "tID" that generates a unique…
keewee279
  • 1,656
  • 5
  • 28
  • 60
0
votes
1 answer

How to create a new table with "default value column" depending on the tables I select from?

Let's say, I have two tables, one for "sales" and another for "stock". Sales table would be like this: ------------------------- | location | item | qty | ------------------------ | 1 | 11 | 1 | | 2 | 12 | 1 …
CairoCoder
  • 3,091
  • 11
  • 46
  • 68
0
votes
1 answer

CREATE TABLE IF NOT EXISTS is truncating table if there is change in schema

I'm creating a table in using CREATE TABLE IF NOT EXISTS, But if there is change in table schema(structure) it is dropping the table and creating a new table. I'm loosing my table data if it is dropping the table. Is there any method to alter if…
Sreenath
  • 480
  • 2
  • 6
  • 17
0
votes
0 answers

Using Synonym in SQL Server 2008 R2 (Create and detect existence of a table)

Is there any way to CREATE a table on SQL Server 2008 R2 by referencing the table name with a synonym? Also how can I detect if any object (the base object) is existing in the database by its synonym? I've recently discovered that you can create a…
NBM21
  • 47
  • 1
  • 8
0
votes
1 answer

Creating a table in Mysql with phpadmin

I keep getting errors when trying to create a products table for a database I'm building. Here is the code I've tried: CREATE TABLE Products ( ProductId int NOT NULL auto_increment primary key, Name varchar(255) NOT NULL, Price…
jmc1690
  • 75
  • 2
  • 2
  • 8
0
votes
1 answer

Is necessary to specify a length of Integer when create a table in SQLITE?

I understand that if you know the length of the value you'll receive you must specify the length. e.g. you will receive a text string with length of 20 always, you specify it when you create your table My question is: i'll receive integers but…
Carlos Mayoral
  • 313
  • 3
  • 12
0
votes
1 answer

Create Table SQL Server where column name is select colName from another table

I am designing a table which contain 90 plus columns. Let's say table name is table_fromCol. All these columns name are values for same column in a table. Let's say table table_colName contains: id colName ----------------- 1 Price 2 …
0
votes
0 answers

Save existing DataGridView data to a new table in MS Access

I have an existing DataTable that binded to DataGridView1. Loading table jobentry with 3 fields [name], [quantity] and [cost] I have several comboboxes and textboxes for the dataentry to this gridview. Now, For each job, I want to save new table of…
0
votes
1 answer

How to add multiple values in single column

I am designing a SQL table structure as: CREATE TABLE InCollection ( author NVARCHAR(200) DEFAULT NULL, title TEXT, year INT DEFAULT '0', booktitle TEXT ) Now column 'author' may have a single value or multiple tags…
maliks
  • 1,102
  • 3
  • 18
  • 42
0
votes
1 answer

Select from rental table in mysql to display items currently rented by user

If you know about sakila sample database, then what is the statement to select items currently rented by a user. If not here is a code explanation: CREATE TABLE IF NOT EXISTS `rentals` ( `item_id` int(10) unsigned NOT NULL, `user_id` int(10)…
kdobrev
  • 270
  • 1
  • 3
  • 11