Skip to content

Tag: database

Export database schema into SQL file

Is it possible in MS SQL Server 2008 to export database structure into a T-SQL file? I want to export not only tables schema but also primary keys, foreign keys, constraints, indexes, stored procedures, user defined types/functions. Also I don’t want the data to be present in this T-SQL file. Is there a…

getting count from the same column in a mysql table?

I wanted to a count of the same field for different values for example: user{user_id, gender} Gender can have obviously male or female 🙂 i want to get count for all the males and females i.e. but im confused because they come from the same gender coloumn thanks Answer Try this for row wise result: Output: Try…

CREATE TYPE on MySQL

I couln’t create a new data type on MySQL. Query is given below How can I do that on MySQL Answer You cannot. MySQL doesn’t have user-defined types. (At least, not in current versions.)

How to write an “exclusive” query in SQL?

I am going over a past paper for a database course I am taking and I am stuck on an SQL question Here is the schema provided Country(name, capital, area), name is the key People(country, population, children, adult) where country refers to the name in Country, population is the total population, and children …

Mysql queries giving error after upgrading

why this simple query not working. I know it was OK before I upgraded my mysql version. i know there are some syntax changes in new version that I done. but this is simple query no join, but not working. Please help me. EDIT: Upgraded from mysql4 to mysql5 and error is ‘syntax error’ Answer I thin…