MySQLで列名の長さが5より大きいすべての列を見つけるにはどうすればよいですか?
HAVINGを使用して、列名の長さが5より大きいすべての列を検索します。これにより、次の出力が生成されます-
+-------------------+-------------------------+ | TABLE_NAME | COLUMN_NAME | +-------------------+-------------------------+ | DemoTable | UserId | | DemoTable | EndDate | | DemoTable | StartDate | | DemoTable | StudentFavouriteSubject | | DemoTable | StudentFirstName | | DemoTable | StudentId | | DemoTable | ShippingDate | | DemoTable | Number | | DemoTable | Value1 | | DemoTable | Value2 | | DemoTable | ArrivalDate | | DemoTable | ShippingDate | | DemoTable | UserAge | | DemoTable | UserId | | DemoTable | UserName | | DemoTable | CustomerId | | DemoTable | CustomerValue | | DemoTable | UserId | | DemoTable | UserMailId | | DemoTable | FirstName | | DemoTable | Number | | DemoTable | isMarried | | DemoTable | Number | | DemoTable | FruitName | | DemoTable | FruitPrice | | DemoTable | CustomerAllProductPrice | | DemoTable | CustomerId | | DemoTable | CustomerName | | DemoTable | UserId | | DemoTable | UserScore | | DemoTable | StudentAge | | DemoTable | StudentCountryName | | DemoTable | StudentFirstName | | DemoTable | StudentId | | DemoTable | StudentLastName | | DemoTable | FirstName | | DemoTable | Arrivaldatetime | | DemoTable | Amount | | DemoTable | Number | | DemoTable | Number | | DemoTable | FirstName | | DemoTable | CustomerId | | DemoTable | CustomerPrice | | DemoTable | CustomerProductName | | DemoTable | CustomerProductQuantity | | DemoTable | Value1 | | DemoTable | Value2 | | DemoTable | FirstName | | DemoTable | LastName | | DemoTable | UserId | | DemoTable | MonthNumber | | DemoTable | YearNumber | | insertcurrentdate | currentDate | | student | first_name | | student | last_name | +-------------------+-------------------------+ 55 rows in set (0.01 sec)
-
MySQLで特定の列名を持つテーブルを見つける方法は?
列名を見つけるには、information_schema.columnsを使用します。以下は構文です- select distinct table_name from information_schema.columns where column_name like '%yourSearchValue%' and table_schema=database(); さまざまなテーブルで列名を見つけるために、上記の構文を実装しましょう。ここでは、特定の列名が「クライアント」という単語を持つテーブル名のみが必要です- mysql> select distinct table_
-
MySQLを使用して1つの新しい列のすべての列を連結します
まず、-を作成しましょう mysql> create table DemoTable1396 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(40), -> Age int -> ); Query OK, 0 rows affected (0.93 sec) insert-を使用して、テーブルにいくつかのレコードを挿入します mysql>