English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Suppose I have table Emp which contains following column: EmpNo, EmpName, EmpAdd.
Now, the question is write an SQL Query to add an index on the EmpName in the Emp table...
Note: This is not homework question...

2007-11-02 00:26:26 · 5 answers · asked by Networking 1 in Computers & Internet Programming & Design

5 answers

The exact syntax depends on what database you've got. There are lots of databases that use SQL as their access language... and lots of versions of those databases.

Here's one way (for Microsoft SQL Server)... it may work for your database:
http://www.1keydata.com/sql/sql-create-index.html

HTH

2007-11-02 00:33:06 · answer #1 · answered by bambamitsdead 6 · 1 0

Guess the EmpNo will be the primary key (unique). To add a secondary index:

CREATE INDEX [index-name] ON EMP (EMPNAME)

Use whatever name you like for [index-name]

2007-11-02 00:38:39 · answer #2 · answered by Anonymous · 2 0

Cheat! Use phpmyadmin!

It's actually a really great learning tool, because it will show you the full query you need.

I *think* the query you want is
ALTER TABLE Emp ADD INDEX(EmpName);

2007-11-02 02:08:39 · answer #3 · answered by sparky_dy 7 · 1 0

there is not any sq. utility, there are databases helping sq. (greater or much less), there are editors that assist you write sq., which one did you prefer? MySQL is a unfastened DB helping sq.. Eclipse is one (of many) editors assisting you to jot down sq. statements... For acquire places use Google...

2016-12-30 14:18:44 · answer #4 · answered by ? 4 · 0 0

http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html

2007-11-02 00:31:08 · answer #5 · answered by chbrules 1 · 1 0

fedest.com, questions and answers