Table, adding, deleting, modifying, and querying fields, adding, deleting, and modifying Fields
Use an SQL statement to add or delete a modified Field
1. Add a field
Alter table docdsp add dspcode char (200)
2. delete a field
Alter table table_NAME drop column column_NAME
3. Modify the field type
Alter table table_name alter column column_name new_data_type
4. Modify Table
JQuery + PHP allows you to edit and save table fields in real time. jquery Fields
This example is applicable to the following scenarios: When you view detailed information, such as user details, and find that the information of a certain field needs to be modified, you can click the content of this field to modify it, saving the user time, (the traditional approach is to enter an editing page to list all th
I. Viewing user namescat/etc/passwd650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/18/wKiom1hENn2RzaKsAABFHZWv8k8877.png-wh_500x0-wm_3 -wmp_4-s_3401578505.png "title=" 44.png "alt=" Wkiom1henn2rzaksaabfhzwv8k8877.png-wh_50 "/>A total of 7 parts per line separated by a colonThe first paragraph refers to the user nameThe second paragraph is the user's passwordThe third paragraph refers to the UID, each user has their own UIDThe fourth paragraph refers to the group UID, each user has
Tags: pps http table name arc amp SLA and Ace netUsed MySQL friends, probably all in the use of phpMyAdmin, I began to use from 2003, feel that things suitable for remote MySQL management, and Not suitable for stand-alone, single-database management operations, especially for development use. Recommend a software management MySQL database for home:SQLyog SQLyog-[Translate this page]Manage, Monitor mysql servers using our popular MySQL GUI Tools. OK, the text begins, we take www.souapp.com
Thoughts on the methods for expressing state or type fields in the database, database fields
When designing a database, we often encounter fields that indicate the status or type, such as the order status or payment type. To select an appropriate data type for this type of data, the following two methods are commonly used.
Method 1: tinyint + byte (enumeration)
SQL Server adds the syntax of multiple fields to the table. SQL Server Fields
Add field syntax
Alter table table_name add column_name + field type + Constraints
Add multiple fields to a table:
Use nature1_oalter table XunHu add MaleCount varchar (50) null, FemaleCount varchar (50) null, SubadultCount varchar (50) null, LarvaeCount varchar (50) null, TraceType
Processing of default database fields in the ADO. NET object data model, ado.net Fields
Whether it is Visual Studio 2010 or 2013 built-in ADO. NET Entity Data model has a small problem: some fields in the database have set the default value, but ADO. NET object data model tool does not automatically set.
In this case, you need to manually set it.
Assume that t
In mysql, how to query all fields and convert one of the fields? for example, select * fromtablewhereid1. in table, a date field needs to be converted to stringDATE_FORMAT (updateTime, #39; % Y-% m-% d % H: % I: % s #39;) asupdateTime indicates that each field is not typed, is there any other way to process the date ???, If the field is too much trouble, the SQL statement will still have a long selectupda
DATEDIFF (minute,f start time, GETDATE ()) >59. Top 10 RecordsSelect Top Ten * form table1 where range10. A result table is derived from all rows in TableA but not in TableB and TableC and all duplicate rows are eliminated(select a from TableA) except (select a from TableB) except (select a from TableC)11. Description: Randomly remove 10 dataSelect Top * FROM tablename ORDER by NEWID ()12. List all table names in the databaseSelect name from sysobjects where type=u13. List all the field names i
Queries whether all tables in the specified database contain specified fields and database fields.
Today, we encountered a problem: to update the values of a field in the database in batches, we need to first find the tables that contain this field, and sort out the following statements to facilitate query.
SELECT DISTINCTT. table_name,C. COLUMN_NAMEFROMInformation_schema.TABLES tInner join information_sc
1. Normal Value of json data: json [I]. fieldName2. json data fields contain spaces: eval ('json ['+ I +'] ["'+ field +'"] ')3. json Data assignment: eval ('json ['+ I +'] ["'+ field +'"] = '+ jsonFilter. length );4. Add fields to json data: loop all data and directly use json [I]. newField = defaultValue.5. Sorting of json data: equivalent to sorting of arrays. json. sort (function (a, B) {return a [name]>
(a. id, a. name, 'Scale'), 0) as N 'decimal ',(Case when a. isnullable = 1 then '√ 'else' 'end) n' allow null ',Isnull (e. text, '') n' default value ',Isnull (g. [value], '') AS n' field description'-- Into # txFROM syscolumns a left join policypes BOn a. xtype = B. xusertypeInner join sysobjects dOn a. id = d. id and d. xtype = 'U' and d. name Left join syscomments eOn a. cdefault = e. idLeft join sys. extended_properties gOn a. id = g. major_id AND a. colid = g. minor_idOrder by object_name
Syntax for adding fields: alter table tablename add (column datatype [default value] [null/not null],...);
Alter table tablename modify (column datatype [default value] [null/not null],...);
Syntax for deleting a field: alter table tablename drop (column );
Multiple columns are separated by commas.
Use alter table to add, delete, and modify a column.
Create a table structure:Create table test1(Id varchar2 (20) not null );
Add a field:Copy codeThe Code
Add new fields (columns) and MYSQL fields to the existing tables in the mysql database.
-- Note: MYSQL has never been used recently because of the need for projects. Although it is used by small and medium-sized enterprises and network companies, it is mainly used across platforms and has a low purchase cost, upgraded to open-source. Therefore, it occupies most of the market share.
Alter table 'database n
Obtain database table fields and database fields
SELECT
Table name = case when a. colorder = 1 then d. name else ''end,
Table description = case when a. colorder = 1 then isnull (f. value, '') else'' end,
FIELD No. = a. colorder,
Field name = a. name,
Id = case when COLUMNPROPERTY (a. id, a. name, 'isidentity ') = 1 then' √ 'else' end,
Primary Key = case when exists (SELECT 1 FROM sysobjects where xtype = '
1. Normal Value of json data: json [I]. fieldName
2. json data fields contain spaces: eval ('json ['+ I +'] ["'+ field +'"] ')
3. json Data assignment: eval ('json ['+ I +'] ["'+ field +'"] = '+ jsonFilter. length );
4. Add fields to json data: loop all data and directly use json [I]. newField = defaultValue.
5. Sorting of json data: equivalent to sorting of arrays. json. sort (function (a, B) {return
The difference between static final string Hello = "hello" and static string Hello = "hello" has never been quite clear. The following is an example:
Public class constclass {static {system. Out. println ("const class Init! ");} // Public static string Hello =" hello "; (1) // public static final string Hello =" hello "; (2 )}
Public class notinitexample {public static void main (string [] ARGs) {system. Out. println (constclass. Hello );}}
If run (1), the output result is
Const class In
Tags: sql const int name default alter logs LTE IMA --First, modify the field default value
Alter TableTable nameDrop constraintConstraint name------Description: Delete the original constraint for a table field
Alter TableTable nameAdd constraintConstraint nameDEFAULTDefault value forField name-------Description: Add a constraint for a table's field and specify a default value
--Second, modify the field name:
Alter TableTable name RenamecolumnA toB--Third, modify the field type:
Alter Table
Label:First, modify the field default valueALTER TABLE name DROP CONSTRAINT constraint name------Description: Delete the original constraint for the field of the tableALTER TABLE name ADD constraint constraint first name default value for field name-------Description: Add a constraint for a table's field and specify a default valueSecond, modify the field name:ALTER TABLE name rename column A to BThird, modify the field type:ALTER TABLE name ALTER COLUMN UnitPrice decimal (4) NOT NULLThird, modi
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.