1

I use a sqllite and I try to create this.

idText idNum  
sav      1    
abd      1     
sav      2 
sav      3
abd      2

Whith MySQL I did this but in sqllite is it possible?

the syntax in mysql is:

DROP TABLE IF EXISTStest.animals;
CREATE TABLEtest.animals(
grpchar(30) NOT NULL,
idmediumint(9) NOT NULL AUTO_INCREMENT,
namechar(30) NOT NULL,
PRIMARY KEY (grp,id)
) ENGINE=MyISAM;
Miguel
  • 2,130
  • 1
  • 11
  • 26
saverix80
  • 109
  • 1
  • 2
  • 8
  • i know the syntax to create composite key. but my problem is that one must be type int auto_increment – saverix80 Apr 29 '16 at 16:00
  • You mean `idNum` will be consecutive _for each `idText` group_? Because right now `idNum` has duplicates so it can't be a true "autoincrement" column – D Stanley Apr 29 '16 at 16:03
  • D Stanley you're right!!!! – saverix80 Apr 29 '16 at 16:08
  • 2
    A composite primary key with an auto increment doesn't make sense. A primary key with an auto increment column will already be unique. Adding a second column to the PK won't make it more unique. –  Apr 29 '16 at 16:10

0 Answers0