开发者

How to view tables in sql?

开发者 https://www.devze.com 2023-02-06 06:34 出处:网络
Hai i am a beginner of Database, i have a .sql file which contains some tables of data, i want to know how to import them and how to view the list of tables.

Hai i am a beginner of Database,

i have a .sql file which contains some tables of data, i want to know how to import them and how to view the list of tables.

presently im using the following:开发者_开发知识库-

software or editor : navicat lite server : localhost. databse file format: .sql


Maybe you can try to execute the script in sql server, then type

select * from [database_name].information_schema.tables

to view tables and relevant information.


Remember that a sql file is not really a database, it is a script. You can run the script from any tool, but I'd use command line. This is navicat connected to mysql?

mysql -u username -p databasename < script.sql
password: **

And then the results can be seen using navicat or any other tool


If the .sql file has statements such as "CREATE TABLE..." and then later on "INSERT INTO..." then the script is possibly creating the tables and inserting the data.

To allow that to happen, the tables need to not exist in the database. You can then run the script and it will create the tables and fill in the data.

If the tables do exist, you can always either delete them, or change the CREATE to an ALTER and the script should then run.

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号