|
Schatak wrote: I am going to start a big construction project with MVC. I am confused about Db
choice. I would recommend postponing the choice.
Schatak wrote: Although worked with SQL server from past 5 years. but now thinking to use
MongoDB. They are not the same, and one would perform poor in the area where the other excells. SQL Server would be preferred for relational data, especially if you are on a Microsoft stack.
I cannot determine whether or not MongoDB supports SQL92. It would be nice to know, since;
- You could postpone the choice of which database-class to use by programming against the IDbConnection interface.
- Inject any database-driver in there
- And if you keep your SQL compatible with SQL92, then any database supporting the standard could be used.
SQL92 is not as rich as the Sql dialect of the server, but it does offer the advantage to swap out the database entirely, simply by changing the configuration.
..but in general, you take risks in small and simple projects; it would be very not fun if you had to make a lot of changes in a very large project after some months of work, and breaking it in the process.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: I cannot determine whether or not MongoDB supports SQL92
There's a reason it's called NoSQL.
NoSQL Explained[^] by Mongo themselves.
|
|
|
|
|
Yes, I opened multiple search results in multiple tabs, and the first contained claims to be SQL92 compatible; but they were ODBC-based commercial solutions.
Believe that it was wikipedia that stated there was no support for joins
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I would use what I know best.
|
|
|
|
|
Right, lets see if my head also think so
|
|
|
|
|
Schatak wrote: Although worked with SQL server from past 5 years. but now thinking to use MongoDB.
Based on what you posted - bad idea.
Only thing that mongodb might be really good at, starting from zero, is storing and retrieving streaming video. And if if you need that then use mongo for that and use the SQL server for everything else.
|
|
|
|
|
Define BIG Construction....
How much data is involved (written to and read from)?
Mainly simple tables with simple types of bugger and heavier types?
You like to encode/decode JSON all the time?
Which requirements are wanted?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I am not very familiar with Powershell. I have been studying how it works with SQL server. I have a few simple scripts but am hoping there are some libraries of cmdlets writen that allow the backup and restore from an ASP . Net application.
|
|
|
|
|
Wouldn't it be easier to execute either as a simple command, as opposed to invoking a powershell script to achieve the same?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This is my first time of creating a trigger..I tried to create trigger using mysql to count how many "2007" data are in the table when inserting new record but it not working properly it wont display how 2007 data are in my table.......
My table have more than 50 data...
CREATE TRIGGER No_of_Publisher_year Before Insert ON Book FOR EACH ROW SET @Count_No=New.Copyright;
SET @Count_NO=0;
INSERT INTO Book VALUES(14,'Programming Perl','978-0-201-70073-2','WI','2007-12-11',25.23,2,2007);
SELECT Count(@Count_NO) AS 'No_of_publisher_in_year_2007' FROM Book WHERE Copyright=2007
|
|
|
|
|
dili1234 wrote: how many "2007" data are in the table when inserting new record
dili1234 wrote: CREATE TRIGGER No_of_Publisher_year Before Insert
The before keyword may be why you are not seeing the results you expect.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
But though i changed Before into after Nothing happened.I want to see the output of the result how just after inserted new value regarding the query....
|
|
|
|
|
Just a dumb question about composite primary key.
I am designing a DB, then i have a specific problem that having 2 primary keys can only solve.
Now I am wondering if having 2 primary keys could hurt performance. Could it be?
I am using MySQL 5.6, and in MyISAM engine.
Any advice will be appreciated.
Thank you
|
|
|
|
|
There cannot be two primary keys; such is always a design-error.
You can have multiple fields that uniquely identify the field, but only one of them will be the actual primary key. The others are 'candidate keys', 'unique constraints'.
No, you don't need a primary key to define a relation, but I would urge to not to. And yes, it will hurt performance.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ohh I see, thank you.
But why MySQL accept this query
CREATE TABLE IF NOT EXISTS `tbl_sample`
(
`tbl_sample_id` INT UNSIGNED NOT NULL,
`tracked_id` INT UNSIGNED NOT NULL,
PRIMARY KEY (`tbl_sample_id`, `tracked_id`)
)ENGINE = MyISAM
what are you referring about "design-error"? do you mean the design standard or the DBMS itself?
Thank you
|
|
|
|
|
Gilbert Consellado wrote: But why MySQL accept this query ..because it defines a single key, which happens to consist of two fields. It is still a single primary key.
Gilbert Consellado wrote: what are you referring about "design-error"? I mean that there can only be one "primary".
Having multiple fields in a primary key is quite common. Yes, a larger key has a slight performance penalty; it has to check more data than in a single field, and any index containing the key will also grow.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
last question, which is better of the two?
#1
CREATE TABLE IF NOT EXISTS `tbl_sample`
(
`tbl_sample_id` INT UNSIGNED NOT NULL,
`tracked_id` INT UNSIGNED NOT NULL,
PRIMARY KEY (`tbl_sample_id`, `tracked_id`)
)ENGINE = MyISAM
#2
CREATE TABLE IF NOT EXISTS `tbl_sample`
(
`tbl_sample_id` INT UNSIGNED NOT NULL,
`tracked_id` INT UNSIGNED NOT NULL,
PRIMARY KEY (`tbl_sample_id`),
INDEX `track` (`track_id` ASC)
)ENGINE = MyISAM
|
|
|
|
|
The upper uses two fields to identify a single record. The lower one uses a single field; they would allow different things.
I'd recommend to use the smallest set of fields required. Imagine you are the end-user, how do you differentiate between each record? What is it that makes a sample unique?
If a sample can only be identified by giving both a tbl_sample_id and a track_id, they'd need both be part of the key. If either can be used, then the smallest would become the key, and the other a unique index (the upper in the first case, lower in the second case).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
You're welcome
|
|
|
|
|
Agree with Eddy... and, if you're of an age, think of "Highlander"... there can be only one.
|
|
|
|
|
ohh, but I don't know what Highlander is
|
|
|
|
|
Highlander - a 1986 sci-fi movie. If you watch it, the comment will become clear.
|
|
|
|
|
Agree with Eddy Vluggen. To add a few things:
- Personally I would define any column combinations that are unique in real world as unique, natural keys, not as primary keys.
- Beyond that I would define a single columns surrogate key for all tables and always fetch/modify rows based on this surrogate key.
For more information, see Surrogate key[^]
|
|
|
|
|
Yup, and Edd save me on this.
But, I am not able or somehow use surrogate keys on this design.
|
|
|
|