mysql

subquery considered as table

how can do assume sub query as table in mssql? ...

Login - User Level

Hi, I would like to make a login page with 2 different user level, Admin & Staff. How can i do it using d code below. Thank u. <?php $host="localhost"; $username="root"; $password=""; $db_name="profile"; $tbl_name="company"; mysql_connect("$host", "$username", "$password")or die("cannot connect...

SQL to batch re-tag items

I've got a MySQL database with typical schema for tagging items: item (1->N) item_tag (N->1) tag Each tag has a name and a count of how many items have that tag ie: item ( item_id (UNIQUE KEY) ) item_tag ( item_id (NON-UNIQUE INDEXED), tag_id (NON-UNIQUE INDEXED) ) tag ( tag_id (UNIQUE KEY) name count ) I need to writ...

MySQL: Complex question with schema given

Here is the schema: Student(Snum, Sname) Course(Cnum, Cname) Prerequisite(Cnum, Prereq) Professor(Pnum,Pname, Dept, Office) Enrollment(Snum, Cnum, Term, Section, Mark) Schedule(Cnum, Term, Section, Days, Time, Room) Class(Cnum, Term, Section, Instructor) The full question is: Find professors (Pnum, Pname, Dept) who whenever taug...

MySQL: List students (Sname) who enrolled in more than 6 (distinct) classes in a term.

Given the schema: Student(Snum, Sname) Course(Cnum, Cname) Prerequisite(Cnum, Prereq) Professor(Pnum,Pname, Dept, Office) Enrollment(Snum, Cnum, Term, Section, Mark) Schedule(Cnum, Term, Section, Days, Time, Room) Class(Cnum, Term, Section, Instructor) I have come up with: SELECT * FROM Student s HAVING MIN( SELECT COUNT(*) FROM ...

how to import database created in microsoft sql server 2005 to MySql server 5.0

I have created database in microsoft sql server 2005 can i use that particular database in mysql server 5.0 . ...

GUI tools for mysql 5.0

Is their any GUI-interface for MySQL, like Microsoft SQL Server 2005 Server Management Studio provides? Because basically I am operating MySQL with command prompt interface. ...

Proper location to set up MySQLdb connection in Pylons: app_globals? Thread safety?

I want to use MySQLdb in Pylons, but can't figure out where to actually connect. It would seem that making the connection in app_globals.py would be convenient: class Globals(object): def __init__(self): self.db = MySQLdb.connect() Then controllers can access the db via the globals. However, this seems to lead to problems ...

How can i handle exception from mysql comming when mysql service is down

I am working with mysql5 and hibernate. I am running my application in tomcat application server. if i stop mysqld service for some seconds, i am getting exception: java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused: connect If i will start service again, old hibernate se...

no_data_found in mysql

I want to implement the following (oracle plsql code) in a mysql stored procedure. begin select id into v_tablenumber from qtable where tablename = upper(p_tablename); exception when no_data_found then null; end; Could someone help me on this please? ...

insert query syntax problem

i have a SQL query as follows String S = Editor1.Content.ToString(); Response.Write(S); string sql = "insert into testcase.ishan(nmae,orders) VALUES ('9',@S)"; OdbcCommand cmd = new OdbcCommand(sql, myConn); cmd.Parameters.AddWithValue("@S", S); cmd.ExecuteNonQuery(); Error: Column 'orders' ca...

MySQL timeouts during Commit

We're having mysterious network problems with MySQL. Simple update query (updating single row using index) usually runs immediately, then sometimes (let's say 1 in 1000 times) fails with timeout. Same with simple insert query. Database is not overloaded. We suspect network problems and are looking for solution, so if anyone has had this...

Ruby Class 500 Error

Why is this not correct. What is wrong with it?? #!/usr/bin/ruby require "mysql" class Game attr_accessor :id, :name, :urlName, :description, :hits, :categorys, :width, :height, :nilGame def load(id) #Load mysql begin # connect to the MySQL server con = Mysql.new('localhost', 'user', 'pass', 'database') ...

Cascading auto-increment keys and C# DataSets - MS SQL vs MySQL

Hi Does anybody know why the cascading foreign key relationships to auto-incrementing primary keys in a .net DataSet behaves differently with MySQL vs. MS SQL? I'll flesh it out a bit. I created a parent table with an AI PK, and a child table with an AI PK and a foreign key field to the parent PK. Then I created a cascading relationshi...

What is a good mysql view editor?

I have tried HeidiSQL and ToadMySQL. The problem with these editors is when I want to edit a view, they put the whole query on one line. What I want, is each select clause on its own line, the from on its on line, each join on its own line, and each where clause on its own line. Any suggestions? ...

sql query error

i have a SQL query as follows String S = Editor1.Content.ToString(); Response.Write(S); string sql = "insert into testcase.ishan(nmae,orders) VALUES ('9',@S)"; OdbcCommand cmd = new OdbcCommand(sql, myConn); cmd.Parameters.AddWithValue("@S", S); cmd.ExecuteNonQuery(); Error: Column 'orders...

MySQL Query Help

I have the following 5 tables: users(user_id) books(book_id, author_id) source_phrases(source_phrase_id, book_id, phrase) synonym_phrases(synonym_phrase_id, source_phrase_id, reader_id, synonym) synonym_ratings(synonym_ratings_id, synonym_phrase_id, rater_id, rating) I am trying to get a query that will select all the books a user has...

data type for text formated as.. bold italics underline and other properties

I want to save the contents from HtmlEditor(Ajax Control) into a database field. If i try to save as VARCHAR than error comes as data too long. Please help. ...

PHP/MySQL 2 'while' statements from 1 mysql query?

Hi, I was wondering if it's possible to have 2 'while' statements using the same 'mysql_query'? I'm using a jquery thumb gallery with the results pulled in from a database. The gallery requires that the images are grouped together in an unordered list, with the text/overlayed content grouped together in hidden divs which need to be sep...

PHP / MySQL Error Querying Email Address

Hi, I've been trying to query an email address using the following statement, however after hours of trying to escape the string successfully I've accepted defeat. The query I am using is: SELECT id, email FROM user WHERE email = '$email' That gives me an error: MySQL Error: You have an error in your SQL syntax; check the manual ...