Skip to content

Commit

Permalink
student database program
Browse files Browse the repository at this point in the history
  • Loading branch information
linrakesh committed Apr 3, 2020
1 parent 9a5c00d commit 19747ef
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Loops/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
x = input('Enter any number ')
sum = 0
for i in x:
y = int(i)
a = y**3
sum = sum+a

i = i+1
print(sum)
6 changes: 6 additions & 0 deletions database/12CS/delete_row.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('delete from games where id=6')
db.close()
print('record deleted')
6 changes: 6 additions & 0 deletions database/12CS/insert_row.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('insert into games values (6,"Python fun")')
db.close()
print('Record added successfully')
9 changes: 9 additions & 0 deletions database/12CS/multiple_row.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('select id,gname from games')
game_name = cursor.fetchall()
print('Your Game is :', game_name)
print('Game Id :', game_name[0])
print('Game name :', game_name[1])
db.close()
7 changes: 7 additions & 0 deletions database/12CS/select_single_word.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('select gname from games where id=6')
game_name = cursor.fetchone()
print('Your Game is :', game_name)
db.close()
9 changes: 9 additions & 0 deletions database/12CS/single_row.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('select id,gname from games where id=6')
game_name = cursor.fetchone()
print('Your Game is :', game_name)
print('Game Id :', game_name[0])
print('Game name :', game_name[1])
db.close()
9 changes: 9 additions & 0 deletions database/12CS/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('select id,gname from games where id=6')
game_name = cursor.fetchone()
print('Your Game is :', game_name)
print('Game Id :', game_name[0])
print('Game name :', game_name[1])
db.close()
6 changes: 6 additions & 0 deletions database/12CS/update_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('update games set gname ="fun with python " where id=6')
db.close()
print('Record updated successfully')
5 changes: 5 additions & 0 deletions database/arushi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', '', 'davschool')
cursor = db.cursor()
cursor.execute('insert into games values (6,"Python fun")')
db.close()
5 changes: 5 additions & 0 deletions database/games_insert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import MySQLdb
db = MySQLdb.connect('localhost', 'root', 'ramji', 'davschool')
cursor = db.cursor()
cursor.execute('insert into games values(7,"cricket-new",750 )')
db.close()

0 comments on commit 19747ef

Please sign in to comment.