Hello, I will do microblogging web service (for school, so don't blast me for lack of new idea) and I worry that DB could be often be overloaded (user could following other users or even tag so I suppouse that SELECT will be heavy - check 20 latest messages which contains all observing tags and user).
My idea is create another table, an...
I have table A in Oracle that has a primary key (id). I need to insert data into this table.
How do I prevent duplicate rows?
...
Hello.
What is the best way to generate a manually int primary key with mysql?
I dont want to use the autoincrement feature.
I taught to create a table with one column of type int named sequence. So every time I'm going to insert a new record first check this column and use the value as the primary key. Then after the insert is success...
I have made a database and 10 tables in mysql(table type NONE)
and i can't create foreign keys. An alert message says
SQLyog
The selected table does not support foreign keys.
Table engine must be InnoDB, PBXT or SolidDB
Will i must alter all of my tables now?
thanks for any hint or suggestion
...
I'm trying to create a stored procedure that uses
SELECT TOP 20 * from tblRecords ....
I want the number of rows returned to be sent to the procedure as a parameter.
For some reason it says I have a syntax error near the parameter I use:
SELECT TOP @PARAM from tblRecords ....
Is there a straight way to do it or will I need to const...
I’m looking for a script that allows me to define my database relations in a simple model file and have the possibility to convert this scheme definition to the explicit formats for MySQL, PostgreSQL and SQLite.
The format could be similar to the definitions you would do in activerecord, so if all fails, I will somehow go with AR if I ca...
Here is my current code:
$sql = "SELECT * FROM user_posts";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array($result))
{
print $row['message'];
}
My goal is to show all of the data in that SQL database through an array. But currently, it only shows the latest one and not...
Users Table
user_id username thumb_id fullimage_id
1 jprescott 14 15
2 lpausch 18 19
Images Table
image_id path
14 jprescott/small.jpg
15 jprescott/big.jpg
16 msamuels/small.jpg
17 msamuels/big.jpg
18 lpausch/small.jpg
19 lpaus...
Hi,
I have 2 columns containing text one will be max 150 chars long and the other max 700 chars long,
My question is, should I use for both varchar types or should I use text for the 700 chars long column ? why ?
Thanks,
...
I have 3 text files each of which contains a list of 20 items.
A new column will be added per new day.
I'd like to display these items in a spreadsheet or spreadsheet type layout with each column adjacent to the next.
Spreadsheet output like:
10-28-09 10-29-09 10-30-09
data1 data2 data3
data1 data2 data3
data1 data2 ...
I am creating a page which would have different field for the user to search from.
e.g. search by:
Grade: -dropdownlist1-
Student name: -dropdownlist2-
Student ID: -dropdownlist3-
Lessons: -dropdownlist4-
Year: -dropdownlist5-
How do I write the select statement for this? Each dropdownlist would need a select statement which woul...
This consists of two questions:
Is MySQL's timestamp field really faster than datetime field in "order by" query?
If the answer to above question is yes, how much faster it could be? Supposed in a table of 100 million rows and frequently sort a bunch of 100-200k rows based on timestamp field inside MySQL, will the sort time improvement...
I have a table called tblRentalRates with the following columns:
rate_id (int)
rate_startdate (datetime)
rate_enddate (datetime)
weekday_rate (money)
weekend_rate (money)
I want to accomplish the following goal:
Write a query that will check the contents of the table and ensure that for the current year, that the data covers ...
How can one call a stored procedure for each row in a table, where the columns of a row are input parameters to the sp without using a Cursor?
...
I have a table 'articles' : id / uid / last_update / content.
I want to construct a sql statement that selects an arbitrary number(say 3) of records of each user(identified by uid) that are most recently updated from the table. How can I do that?
...
Is it a good idea to have a 'search table'?
for example a search that can search 'users', 'groups' and 'pages' (facebook style) would have fields like keywords, userid, groupid, pageid
that way the system can do a LIKE query on the keywords from one table.
or would it be better like
keyword1, keyword2, keyword3, keyword4, keyword5, u...
I have 2 tables:
roomtypes[id(PK),name,maxAdults...]
features(example: Internet in room, satelite tv)
Can both id and name field be unique in the same table in mysql MYISAM?
If the above is posible, I am thinking of changing the table to:
features[id(PK),name,roomtypeID] ==> features[id(PK),name,roomtypeNAME]
...because it is he...
Hi
What is the best data type to choose in C# for representing a SQL Serer UniqueIdentifier type? I'm was going to use a GUID but I've seen people using varChars.
Thanks
...
Hi Folks,
how do you handle middle sized projects with PHP and Zend Framework. Do you use Zend DB Table / Row for your Models and Database operations ? Or do you have some kind of Abstract Model class with your SQL Statements ?
I would like to hear some opinions, thanks.
...
I'm trying to configure a parameterized query to the effect of:
SELECT field1 FROM myTable WHERE field2 IN (1,2,3,4)
The database I'm using is Postgres.
This query run successfully unparameterized, but I'd like to use a parameterized query with a JdbcTemplate to fill in the list for valid field2 values (which are integers).
Trying v...