MySQL Forums
Forum List  »  SQLite

Re: sqlite to mysql
Posted by: Devart Team
Date: February 17, 2011 12:50AM

MySQL has much more data types. Firstly, you should read about the MySQL data types and CREATE TABLE syntax -
Data Types
CREATE TABLE Syntax

SQLite TEXT can be converted to MySQL VARCHAR(length), or to TEXT, MEDIUMTEXT, etc., it depends on your needs. For example -
...
author VARCHAR(255),
text MEDIUMTEXT, -- A TEXT column with a maximum length of 16,777,215 (224 – 1) characters.
...

SQLIte INTEGER can be converted to MySQL INT(11); actually INTEGER in MySQL is a synonym for INT.

Quote

I am wondering how other people have got around the problem of creating unique or primary keys on tables.

In this case 'UNIQUE (name, version)' requires to specify an index prefix length
for `name` column, because for TEXT columns a prefix length must be given in the index definition. Here are examples -
CREATE TABLE wiki(
  name TEXT,
  version INTEGER,
  UNIQUE (name(20), version)
);

CREATE TABLE wiki(
  name VARCHAR(255),
  version INTEGER,
  UNIQUE (name, version)
);

Take advantage of visual object editors in dbForge Studio for MySQL (Express Edition).

Devart Company,
MySQL management tools
http://www.devart.com/dbforge/mysql/

Options: ReplyQuote


Subject
Views
Written By
Posted
13591
February 11, 2011 03:13PM
Re: sqlite to mysql
6605
February 17, 2011 12:50AM
3315
February 18, 2011 01:43PM
3186
March 28, 2011 12:40AM
2889
April 01, 2011 12:35AM
4016
May 16, 2011 05:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.