[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 779
  • Last Modified:

Mysql Partitioning Alphabetically

Hi,

Is there a way to partition alphabetically.  I have a table called "Users".  I would like to list all "fname" (first names) that start with A, then all that start with B and so on.

Any thoughts?

Ta
0
infadmin
Asked:
infadmin
  • 2
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
u mean u want to run a query on the table Users which sort them alphabetically?
0
 
infadminAuthor Commented:
No partition.http://dev.mysql.com/doc/refman/5.1/en/partitioning.html

Cant see anything in that link tho to help me.
0
 
haijeromeCommented:
Hai

      It is possible.
       
       Here's the syntax

--------------------------------------------------------------------------------------------------------------------------

          CREATE | ALTER TABLE ()
          ENGINE =
          PARTITION BY  ();

         can be RANGE LIST HASH or KEY

--------------------------------------------------------------------------------------------------------------------------
     
          Ok let's come to our case. You want  to partition based on alphabetical order
       

  CREATE TABLE tbl_users (
  userid INT AUTO_INCREMENT,
  fname VARCHAR(30),
  lname VARCHAR(30)
) ENGINE = MYISAM
  PARTITION BY KEY( fname);



If this not works let me know........have also attached a PDF with this


Regards

Jerome
   
         
 
2085418-MySQL-Partitioning.pdf
0
 
infadminAuthor Commented:
STAR!  Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now