create-table

android sqlite CREATE TABLE IF NOT EXISTS

笑着哭i 提交于 2019-12-21 07:12:38
问题 Having a little problem with creating new tables. When I use the CREATE TABLE command my new tables form as they should, but when I exit the activity the app crashes and I get a TABLE ALREADY EXISTS in the logcat. If I use CREATE TABLE IF NOT EXISTS the new table isn't formed but just adds my new rows of data to a previous table and it doesn't crash. What is wrong with this? I would like to add the table without it giving me the already exists and I would like it to add without it adding rows

Column, parameter, or variable #10: Cannot find data type

假装没事ソ 提交于 2019-12-21 06:57:52
问题 I'm trying to create table from template code. This template code is working: CREATE TABLE [dbo].[Table1] ( [Field1] [int] NULL, [Field2] [float] NULL ) ON [PRIMARY] But if I put varchar(10): CREATE TABLE [dbo].[Table1] ( [Field1] [int] NULL, [Field2] [varchar(10)] NULL ) ON [PRIMARY] I get error: Msg 2715, Level 16, State 7, Line 1 Column, parameter, or variable #2: Cannot find data type varchar(10). 回答1: The problem are brackets []. You have to put only varchar into brackets: [varchar](10)

Why does all columns get created as string when I use OpenCSVSerde in Hive?

杀马特。学长 韩版系。学妹 提交于 2019-12-21 04:43:08
问题 I am trying to create a table using the OpenCSVSerde and some integer and date columns. But the columns get converted to String. Is this an expected outcome? As a workaround, I do an explicit type-cast after this step (which makes the complete run slower) hive> create external table if not exists response(response_id int,lead_id int,creat_date date ) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ('quoteChar' = '"', 'separatorChar' = '\,', 'serialization

Create table syntax not working in hsql

旧时模样 提交于 2019-12-20 19:36:07
问题 I am new to hsqldb. I am developing simple application to get the some input from user. So Searched for embedded database and found hsqldb is the solution for my requirement. I have some create table syntax but it throws exception. (This Query executed by using Netbeans Database services) Query : CREATE TABLE company ( comp_name varchar(100) NOT NULL, comp_id int(40) NOT NULL AUTO_INCREMENT, PRIMARY KEY (comp_id) ); or CREATE TABLE company ( comp_name varchar(100) NOT NULL, comp_id int(40)

Create table syntax not working in hsql

痞子三分冷 提交于 2019-12-20 19:35:48
问题 I am new to hsqldb. I am developing simple application to get the some input from user. So Searched for embedded database and found hsqldb is the solution for my requirement. I have some create table syntax but it throws exception. (This Query executed by using Netbeans Database services) Query : CREATE TABLE company ( comp_name varchar(100) NOT NULL, comp_id int(40) NOT NULL AUTO_INCREMENT, PRIMARY KEY (comp_id) ); or CREATE TABLE company ( comp_name varchar(100) NOT NULL, comp_id int(40)

MySQL - How to create a new table that is a join on primary key of two existing tables

怎甘沉沦 提交于 2019-12-20 18:38:12
问题 I have two existing tables, with different fields, except for Primary ID (a varchar, not an int). I want to create a third table which is essentially a merge of these two, such that for a given Primary Key I have all fields in one table. What's the bext way of doing this? Many thanks 回答1: If you are sure you have one and exactly one row in both tables for a given primary ID, then this should work: SELECT tablea.field1, tablea.field2, tablea.field3, ... tablea.fieldn, <---- field list tableb

Performance/efficiency of 2 SELECT statements vs UNION vs anything else in MySQL-PHP

戏子无情 提交于 2019-12-20 04:24:10
问题 Which is more efficient/better practice/less costly in MySQL (with PHP)? SELECT ing two separate statements, UNION ing them into one, or something else I found online about CREATE ing a temporary table as the MySQL equivalent of SELECT INTO ? Or anything else you can think of? The result will be used in a PHP script. Queries: The first SELECT (let's call it Query A) will always yield 10 rows, 4 columns no matter what. The second SELECT (Query B) will always yield 1 row, 4 columns no matter

Create table but Drop it if the table exists already

淺唱寂寞╮ 提交于 2019-12-19 09:25:04
问题 I am working on a request where I have to create a table to insert some data. So, obviously I will have first have a delete table st. before the create st. but when I am running this for the first time(before the table can be created) it will pop up an error saying table not created and then creates table and goe son from here. So every time any one runs my code for the first time it will pop up this error at drop table st. Does any one have any better idea?? Some thing like " if table exists

SQLite Foreign Key

蓝咒 提交于 2019-12-18 10:35:47
问题 I'm following the instructions from the SQLite documentation at http://www.sqlite.org/foreignkeys.html however my attempt to add a foreign key is failing. Here are my create statements: CREATE TABLE checklist ( _id INTEGER PRIMARY KEY AUTOINCREMENT, checklist_title TEXT, description TEXT, created_on INTEGER, modified_on INTEGER ); CREATE TABLE item ( _id INTEGER PRIMARY KEY AUTOINCREMENT, FOREIGN KEY(checklist_id) REFERENCES checklist(_id), item_text TEXT, item_hint TEXT, item_order INTEGER,

C# - Create SQL Server table programmatically

别来无恙 提交于 2019-12-18 03:21:08
问题 I am trying to create a SQL Server table programmatically. Here is the code. using (SqlConnection con = new SqlConnection(conStr)) { try { // // Open the SqlConnection. // con.Open(); // // The following code uses an SqlCommand based on the SqlConnection. // using (SqlCommand command = new SqlCommand("CREATE TABLE Customer(First_Name char(50),Last_Name char(50),Address char(50),City char(50),Country char(25),Birth_Date datetime);", con)) command.ExecuteNonQuery(); } catch (Exception ex) {