Discover rename table name in mysql, include the articles, news, trends, analysis and practical advice about rename table name in mysql on alibabacloud.com
connection to MYSQL is slow. sometimes it takes 4-20 seconds to remotely connect to MYSQL, and the local connection to MYSQL is normal. the main cause of this problem is that the reverse DNS resolution is enabled for MYSQL installed by default, in MY. INI (in WINDOWS) or MY. add skip-
table2.4.2 alter Modify table (column) field2.4.3 Delete drop table (column) field2.4.4 Rename renaming table names2.5 Create new table with existing data3. Operation and management of data3.1 Add data (Increase)3.2 Deleting data (delete)3.3 Modifying data (change)3.4 Query
When creating a table, MySQL creates a. frm file to save the table and column definitions. Indexes are stored in a file with the. MYI (MYindex) Extension and data is stored in a file with the. MYD (MYData) extension.
1. Use the SHOW/DESCRIBE statement to display data table information
Syntax:Show tables [FROM db_name]
We know that,MySQLDatabases are often combined with PHP to develop powerful applications. So for those who are new to PHP programming, it is necessary to understand some simple MySQL database operations. In this article, we useAlter tableStatement to modify the table structure. Next let's take a look at this part.
1. Add Columns
Alter table tbl_name add col_name
Free up space for MySQL ibdata1 fileMysqldump options:--add-drop-table: Adds a statement that deletes a database table before each database table statement is created;--add-locks: Lock database tables when backing up database tables;--all-databases: Back up all databases on the MyS
: date and time, for example, '2017-01-02 12:23:43'TimeStamp: timeStamp, which is automatically assigned to the current date and time. Create an employee tableCreatetable employee (id int, name varchar (20), sex bit, birthday date, salarydouble, entry_date date, resume text );* View:View all tables:Showtables;View the statement for creating a specified tableShowcreate table employee;
Basic operations for mysql Data Tables: Table Structure operations, field operations, and basic mysql operationsThis section introduces:
Table Structure operations
Create a data table,
View data tables and View fields,
Modify data t
problem by reducing the scenario of table reconstruction and table lock, but this method cannot cover all possible operations, for example, when modifying the Data Type of a column, full table reconstruction is required. Przemysaw and malkoski discussed how to modify the definition in Mysql5.6 last year in as much detail as possible.
With the new features of
connection query (mainly left table record)2. Right connection query (based on right table record) Left Join answer QueryFormat: Select field List from Table A LEFT JOIN table B on conditional expression; Right connection queryFormat: Select field Name list from
The Parameter Name of the mysql stored procedure should not be the same as the field name. The result will be that the parameter value will not be the value you passed in, it is the value of the field in each record. Such consequences are often serious. For example, you can delete all the records of the entire table. T
Title, the result will be that the value of the parameter will not be the value you passed in, but the value of the field for each record.The consequences of this are often severe. For example, to perform a delete operation, it can completely delete the entire table record.This is my bloody price.The dead pit is as follows, do not jump:[SQL]View Plaincopy
DELIMITER $$
Use ' b10k ' $$
DROP PROCEDURE IF EXISTS ' sp_delete_species '
table exists.Copy the old table data to the new table (assuming the two tables have the same structure)
insert into new_tableselect * from old_table;
Copy the old table data to the new table (assuming the two tables have different structures)
insert into new_table(field1
table can have more unique keys to create indexes index index_nameALTER TABLE Xixi add index index_name (name)--defines the index when creating a table with the Name field under the Xixi table: Create tables Xixi (ID int (4),
NameDROP PRIMARY KEY;Note: If you have a auto_incrment attribute, you must first delete theAuto_incrment to delete a primary key 9. Add UniquenessA.alter Table NameADD UNIQUE key| INDEX (field name);B.a.alter Table NameADD [CONSTRAINT constraint name] UNIQUE key| INDEX (field name
sp_rename N ' table name. Field name ', ' new field name ', ' column 'sp_renameChanges the name of a user-created object (such as a table, column, or user-defined data type) in the current database.Grammarsp_rename [@objname =] '
keys in the new TABLE, it controls how alter table works. If IGNORE is not specified, the copy is abandoned and restored to its original state. If IGNORE is specified, only the first row is used for the unique key, and the rest are deleted.
You can issue multiple ADD, ALTER, DROP, and CHANGE clauses in a single alter table statement. This is an extension of ANSI
MySql adds, deletes, modifies the field name, and modifies the field type bitsCN.com
MySql adds and deletes fields, modifies field names, and modifies simple syntax of the field type MySql, which is commonly used but not easy to remember. Of course, these SQL syntaxes are basically common in various databases. Listed
system. Table name, otherwise the default is the table under System, which causes an error
2. remap_table if in the same schema, although do not add remap_schema, but the table name before the remap_table Colon must have schema information, the
Tags: developing where local MySQL GoogleToday received the development of the sister's needs, import the data for the specified month to the test suit MySQL specified table (table name is not the same)First look at the overall size of the
with UTF8 character setCREATE DATABASE IF not EXISTS ' db ' DEFAULT CHARACTER SET UTF8;--9. Deleting a databaseDROP DATABASE IF EXISTS ren2;DROP DATABASE IF EXISTS ren1;--10. View the DatabaseSHOW DATABASES;--11. Common Information functionsSELECT VERSION (); --Current database server version informationSELECT DATABASE (); --Query the current librarySELECT Current_User (); --View the current userSELECT USER (); --View the current userSELECT curdate (); --View the current userSELECT current_date
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.