MySQL and SQL Server trace comparison

Source: Internet
Author: User

The test that appears in the following SQL Server and MySQL is a table (except for special instructions)

1. View the script created by the table

SQL Server:

Mysql:

Show create TABLE test;

2. View table structure

SQL Server

Sp_columns test;

Or

Sp_help test;

Mysql:

Show columns in test;

Or

DESC test;

3. See which tables are in the database

SQL Server:

Select name from sysobjects where xtype= ' U '

Mysql:

Select Table_name,table_rows from Information_schema.tables

where table_schema= ' TestDB '

This feeling MySQL do better, Infromation_schema is a database, the database has a view of the table, and our usual query statements have consistency, direct select column name from the table; Table_rows describes the current number of rows in this table.

Use INFORMATION_SCHEMA;

Select Table_name,table_rows from tables

where table_schema= ' TestDB '

Using workbench to connect to MySQL, you can select a database, right--schema Inspector

Here is a list of almost all the information you want about this database, including tables, columns, indexes, triggers, views, etc.

There's a simple way,

Use database name;

Show tables;

4. See what databases are available

Mysql:

show databases;

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.