hi, can u tell how many columns a table can have? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

hi, can u tell how many columns a table can have?

19th Apr 2015, 5:23 AM
Ashpak
3 Answers
+ 6
Yes. There are different ways, depending on which version you use. In PostgreSQL, you'd enter "\d" (or "\l" in some cases) into the prompt, and you'd be provided a list of tables. In SQLite3, you'd enter ".tables" to get the same thing, for example. You can even find out the total number of rows in each table. In SQLite3, using Python, that code might look something like this: database = sqlite3.connect('example.db') db = database.cursor() x = db.execute('SELECT * FROM example_table').fetchall() print('The table has ' + str(len(x)) + ' rows.') What is returned upon assigning x the database query, is a list of "tuples", meaning a list of rows containing the data you queried from the database. In the print statement, I have "len(x)", which would return the total quantity of rows.
21st Feb 2018, 2:46 PM
Fox
Fox - avatar
0
you can create more 250 - 1000
24th May 2015, 6:01 AM
Ramesh Kumar Konduru
Ramesh Kumar Konduru - avatar
0
Even more in some situation.
17th Mar 2016, 10:51 AM
Roman Svyrydenko