0

I need help in coding a simple program in python to allow python to create a database (without me having to see the file open) which will then have a table in the database that I can add fields to, without seeing the table or manually editing it. Also I would like to be able to use some code to search for and order the results in the database table.

I know that I will not be able to see the table, as I will only be able to add and view results that I have searched for

I want the table to be called 'resultstable'

and I want the following fields to be in the table:

firstname surname classnumber [I will only have one class number] quiz_score [this will be from 1 to 10]

I would like to be able enter three results for one pupil, which I also do not know what to do.

I understand print commands and creating variables but I would like an explanation of what other parts of the code are doing when I run the program. Hope you can help!

Emcoder
  • 1
  • 1
  • 1
    This forum helps people that write programs themselves overcome problems that they encounter in the process. What you currently claim to know is definitely not enough for the task. You need to [study Python](http://stackoverflow.com/questions/3088/best-ways-to-teach-a-beginner-to-program), [databases](http://faculty.ksu.edu.sa/zitouni/Documents/introDB.pdf) and [SQL](http://www.sqlcourse.com/intro.html) first. No, this is not what you'll complete in one weekend. – 9000 Mar 26 '15 at 14:01

1 Answers1

0

For database creation Use CREATE DATABASE

For table creation Use CREATE TABLE

CREATE TABLE resultstable (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
surname VARCHAR(30) NOT NULL,
classnumber INT(6),
quiz_score INT(6) ) ;

http://dev.mysql.com/doc/connector-python/en/connector-python-example-ddl.html

mysqlrockstar
  • 2,536
  • 1
  • 19
  • 36