|
|
Posted on 2/22/2019 3:41:41 PM
|
|
|
|

This post was last edited by Kongcida on 2019-2-25 09:05
It really smells
I first wanted to enter the programmer pit when I came into contact with a foreign game in my junior year The hyperlink login is visible. (I swear that I don't want to advertise NetEase's so-and-so game, and now it should be copyrighted by NetEase??) )。 When I played this game before, there was no server in China. The game loads super slowly, and a handful of CodeCombat enthusiasts appear. There are a few big cows who set up one in their own hometown, and then they may be busy with their studies and work, and they don't play this game anymore. At that time, Python had just come out and was hot, so the language I chose in the game was Python. With each level, I found a little interest and a sense of accomplishment in games and programming. Later, I started watching Python learning videos on MOOC.com. But, in the end I became a C# development rookie 233333~ . Later, due to physical reasons, the C#. I have to say that Microsoft Barbie's IDE is really good, debugging, smart hints emmmmm is really fragrant.....
Here are some SQL notes from my self-study:
environment
Tools needed
Text
#Create a database
The above execution results are:
In this way we have created a database, although we have a simpler way to write it as follows:
The result of this writing method is the same as above, and we can also create a database called DemoDb with the default size of the database.
# Delete the database
We always encounter "Unable to delete the database "DemoDb"", because the database is currently in use." This is because the process connecting to the database has not been closed
* At this time, we can directly right-click on the database -> close the existing connection to the database -> OK
As shown in the figure:
* Or we can use the method of killing the process with the cursor and then deleting the database
The above is to create a database and delete a database
Step on the pit
When creating the database, you can see Note 1 and Note 2 in the code. Some people will be curious, since Note 1 is the name of the database to be created, why is there a name in Note 2. The note says "The name here refers to the logical name of the database in sys.database_files", so what does this mean? In what scenarios would this name be used?
To find out what's next, listen to the next breakdown...... Ahem, just kidding...
When I first joined the company to do a project, my colleague gave me a .bak database backup. Create a database according to the name above, and then attach the database backup (tutorial later), so that it is backed up to the local area. However, due to project architecture issues, querying a table data will execute n queries for tables associated with the table. In this way, various database operations have caused the database log to soar to 40G in a month (it was really a brain to put the database on the C drive at the beginning, and then the database was moved to another disk). Then I looked for a way to delete the database log in various posts on the Internet, and found a few that all reported errors when executed. I thought it was an online reaching party, but they carried it wrong. Later, I really couldn't do it, so I had to check the reason for the error.
After executing this database code, the error message here is "File 'LogistarOA20171106_log' for database 'LogistarOA20171106' cannot be found in sys.database_files. The file does not exist or has been deleted.The reason for the query is that in "sys.database_files", the logical name of this database is not 'LogistarOA20171106_log'.
The following is the query code:
The query results are:
Obviously the file name and logical name of the database log are different, one is 'LogistarOA20171106_log' and the other is 'CQJHJShippingOA_log'. Let's change Note 5 in the code and it's OK.
emmmmm... Normal people can't step on this pit, and the problems I may encounter are more strange......
|
Previous:Morning Post | Friday, February 22, 2019Next:ideaSet up the Alibaba Cloud image in the Maven repository
|