cosmopolitan Posted March 4, 2020 Report Posted March 4, 2020 22 minutes ago, kevinUsa said: got it bro fetchall() y using here select statement ki vache data/result ni it will fetch and put it .. Quote
Ellen Posted March 4, 2020 Report Posted March 4, 2020 14 minutes ago, MeetFriendz said: print(table) ('Student') print function does not work that way ; syntax print(object) anthe anamata ; just correcting so if anyone sees this does not make that mistake 1 Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 11 minutes ago, cosmopolitan said: select statement ki vache data/result ni it will fetch and put it .. go ti t Quote
cosmopolitan Posted March 4, 2020 Report Posted March 4, 2020 1 minute ago, kevinUsa said: go ti t @tamu @Biskot threads chusukuntu reply iyaku bro.. 1 Quote
Sarvapindi Posted March 4, 2020 Report Posted March 4, 2020 35 minutes ago, kevinUsa said: i want ot print values from student table only just started to learn python How n where To start ba..i also want to learn python but donno where to start? Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 10 minutes ago, cosmopolitan said: @tamu @Biskot threads chusukuntu reply iyaku bro.. bro ala kadu bro Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 10 minutes ago, Sarvapindi said: How n where To start ba..i also want to learn python but donno where to start? I am learning from udemy Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 import sqlite3 conn = sqlite3.connect('aaa.sqlite') cur = conn.cursor() cur.execute('DROP TABLE IF EXISTS Student') cur.execute('DROP TABLE IF EXISTS Courses') cur.execute('CREATE TABLE Student(name TEXT, Student_id INTEGER, course_id INTEGER)') cur.execute('CREATE TABLE Courses (course_id INTEGER, Course_name TEXT)') cur.execute('INSERT INTO Student (name, Student_id, course_id ) VALUES (?,?,?)', ( 'TOm', '20044844', '12346' )), cur.execute('INSERT INTO Student (name, Student_id, course_id ) VALUES (?,?,?)', ( 'TOm2', '20044842', '12345' )), cur.execute('INSERT INTO Student (name, Student_id, course_id ) VALUES (?,?,?)', ( 'TOm4', '20044843', '12344' )), cur.execute('INSERT INTO Student (name, Student_id, course_id ) VALUES (?,?,?)', ( 'TOm5', '200448442', '12343' )) cur.execute('INSERT INTO Courses (course_id ,Course_name) VALUES (?,?)', ( '12345','maths' )), cur.execute('INSERT INTO Courses (course_id ,Course_name) VALUES (?,?)', ( '12346','science' )), cur.execute('INSERT INTO Courses (course_id ,Course_name) VALUES (?,?)', ( '12344','stats' )), cur.execute('INSERT INTO Courses (course_id ,Course_name) VALUES (?,?)', ( '12343','eng' )), cur.execute('INSERT INTO Courses (course_id ,Course_name) VALUES (?,?)', ( '12342','econ' )) student_obj=cur.execute('SELECT Student.name,Student.Student_id, Courses.Course_name FROM Student JOIN Courses ON Student.course_id = Courses.course_id').fetchall() course_obj=cur.execute('SELECT course_id, Course_name FROM Courses').fetchall() print(student_obj) print(course_obj) Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 1 minute ago, k2s said: deni meaning endi Quote
cosmopolitan Posted March 4, 2020 Report Posted March 4, 2020 for loop rasukoni .. rows line ga print chesukovachu.. def print_func(input_obj): for i in input_obj: print(i) return print_func(student_obj) print_func(course_obj) Quote
kevinUsa Posted March 4, 2020 Author Report Posted March 4, 2020 Just now, cosmopolitan said: for loop rasukoni .. rows line ga print chesukovachu.. def print_func(input_obj): for i in input_obj: print(i) return print_func(student_obj) print_func(course_obj) got it Quote
VictoryTDP Posted March 5, 2020 Report Posted March 5, 2020 Kevinu you are printing the string student instead of the object Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.