清空数据库的表
程序员文章站
2022-03-15 15:13:37
...
s="""
| ANSWERS |
| ANSWER_EVALUATIONS |
| BULLETINS |
| BULLETIN_RECEIVERS |
| CHAT_LOGS |
| COLLECTION_QUESTIONS |
| COMMON_NEWSES |
| COMMON_NEWS_CHANNELS |
| COURSES |
| CURRENT_STUDY_NODES |
| CUSTOMIZE_NEWS_CHANNELS |
| EVALUATION_MEMBER |
| EVALUATION_MSG |
| EVALUATION_TASK |
| EXERCISES |
| EXERCISE_RECEIVERS |
| EXERCISE_STRATEGY |
| EXERCISE_STUDENTS |
| EXPERIMENT |
| EXPERIMENT_COURSES |
| FORUMS |
| FORUM_CATEGORIES |
| FORUM_POSTS |
| FORUM_TOPICS |
| FORUM_TOPIC_TO_USER |
| FORUM_TO_USER |
| FRIEND_GROUPS |
| FRIEND_LINKS |
| GRADES |
| GRADE_COURSE |
| GROUP_TO_ROLE |
| HOMEWORK_RECORD |
| KNOWLEDGE_DOCUMENT |
| KNOWLEDGE_NODES |
| LEARNING_RESOURCE |
| LEARNING_RESOURCE_TO_NODE |
| LEARNING_RES_TO_RECOMMEND_RES |
| LOW_PRACTICE_RECORD |
| MASTER |
| MESSAGES |
| MESSAGE_RECEIVERS |
| MESSAGE_STATISTICS |
| PAPER |
| PAPER_ANSWER_JUDGE |
| PAPER_ANSWER_JUDGE_ITEM |
| PAPER_ARRANGEMENT |
| PAPER_STRATEGY |
| PAPER_STRATEGY_ITEM |
| PERSONAL_NOTE |
| PRACTICES |
| PRAXIS_ANSWER_STATISTICS |
| PRAXIS_CONTENT |
| PRAXIS_PAPER |
| PRAXIS_REVIEW |
| PRAXIS_STAT |
| QUESTIONS |
| QUESTION_EVALUATIONS |
| QUESTION_LIBRARIES |
| RECENT_CONTACTS |
| RECOMMEND_RECEIVERS |
| RECOMMEND_RESOURCES |
| RECOMMEND_RES_TO_RES |
| ROLE_TO_RESOURCE |
| SCHEDULINGS |
| SCHEDULING_RECEIVERS |
| SCHOOLS |
| SITE_VISIT_STATES |
| SUP_QUES_OF_PAPER |
| SYSTEM_CONFIGS |
| SYSTEM_LOGS |
| SYSTEM_RESOURCES |
| TASK_ARRANGES |
| TASK_PRACTICE_RECORD |
| TASK_RECEIVERS |
| TC_MA_VERSIONS |
| TEACH_RESOURCES |
| TEACH_RESOURCES_CACHE |
| TEACH_RESOURCES_COMMENTS |
| TEACH_RESOURCES_RECOMMEND |
| TEACH_RESOURCES_TO_USERS_ACCEPT |
| TEACH_RESOURCES_TO_USERS_ACCEPT_GROUP |
| TEACH_RESOURCES_TO_USERS_STORE |
| TEXTBOOK_ARRANGES |
| TINY_QUES_OF_PAPER |
| UPLOAD_FILES |
| USERS |
| USER_GROUPS |
| USER_ROLES |
| USER_TO_FRIEND_GROUP |
| USER_TO_GROUP |
| USER_TO_ROLE |
| VICE_ADMIN_USER_TO_GROUP |
| VOD_RECORDS |
| VOTE_OPTIONS |
| VOTE_QUESTIONS |
| WORK |
"""
sql=""
for t in s.split('|'):
t = t.strip()
if t == '':
pass
else:
if t=='USERS':
sql += "DELETE FROM "+t+" WHERE ACCOUNT!='admin';"
elif t in ('USER_TO_ROLE','USER_ROLES'):
pass
else:
sql += "DELETE FROM "+t+";"
fd=open(r'c:\delete.sql','w')
fd.write(sql)
fd.close()
print sql