Jump to content

Resorting Data Records into a Table?


random1

Recommended Posts

My Data Table:

 


CREATE TABLE IF NOT EXISTS `file_type` (
  `filetype_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'The ID of the file type',
  `filetype_extension` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The extension of the file type',
  `filetype_name` varchar(300) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The name of the file type',
  `filetype_description` varchar(500) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The Description of the file type',
  PRIMARY KEY (`filetype_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

REPLACE INTO `file_type` (`filetype_id`, `filetype_extension`, `filetype_name`, `filetype_description`) VALUES
(1, 'jpg', 'Joint Photographic Experts Group', 'A compression technique for color images that can reduce files sizes to about 5% of their normal size. Some detail is lost in the compression.'),
(2, 'zip', 'ZIP Archive', 'An open standard for compression and decompression used widely for PC download archives, ZIP was developed by Phil Katz for his DOS-based program PKZip, and it is is now widely used on Windows-based programs such as WinZip and Drag and Zip.'),
(3, 'pdf', 'Portable Document Format', 'A document-encoding process developed by Adobe that maintains page layout, fonts, and graphics.'),
(4, 'exe', 'Executable', 'A program file in the Windows environment.'),
(5, '7z', '7-Zip Archive', 'A highly compressed archive that contains files. Commonly used for backups and archiving.');

 

I'd like to convert the ordering of the table from:

 

convertto.jpg

 

to:

 

convertfrom.jpg

 

(i.e. Reordering the table alphabetically by the  'filename_extension' column)

 

By this I don't mean ORDER BY in a SELECT statement, but I mean reordering the records themselves.

 

Any ideas?

 

(The table I'm showing here is just an example, the table I really want to order has over 15000 records)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.