Inserting Data into 'user_tab' Table in MySQL

This example demonstrates how to insert a new record into a MySQL table named 'user_tab'. The table has the following columns:

  • id: Unique identifier for the user
  • login_name: Login username
  • name: User's full name
  • mobile: User's mobile phone number
  • email: User's email address
  • pwd: User's password
  • description: A brief description of the user
  • type: User type, e.g., 'admin', 'user'
  • enabled: Flag indicating if the user is active

Here's the SQL INSERT statement to insert a new user record:

INSERT INTO user_tab (id, login_name, name, mobile, email, pwd, description, type, enabled) 
VALUES (1, 'john123', 'John Smith', '1234567890', 'johnsmith@email.com', 'password123', 
        'A software engineer with 5 years of experience', 'admin', 1);

Explanation:

  • INSERT INTO user_tab: Specifies the table to insert the data into.
  • (id, login_name, name, mobile, email, pwd, description, type, enabled): Lists the columns to be populated.
  • VALUES (1, 'john123', 'John Smith', '1234567890', 'johnsmith@email.com', 'password123', 'A software engineer with 5 years of experience', 'admin', 1): Provides the values to be inserted for each column in the corresponding order.

This code demonstrates a basic INSERT statement for the 'user_tab' table. You can adapt it to insert different data or modify the table structure as needed.

MySQL INSERT Statement for user_tab Table

原文地址: https://www.cveoy.top/t/topic/ovjr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录